feat(classes.smartarchive): Support URL streams, recursive archive unpacking and filesystem export; improve ZIP/GZIP/BZIP2 robustness; CI and package metadata updates
This commit is contained in:
		| @@ -4,10 +4,4 @@ import * as smartfile from '@push.rocks/smartfile'; | ||||
| import * as smartrequest from '@push.rocks/smartrequest'; | ||||
| import * as smartstream from '@push.rocks/smartstream'; | ||||
|  | ||||
| export { | ||||
|   path, | ||||
|   smartpath, | ||||
|   smartfile, | ||||
|   smartrequest, | ||||
|   smartstream, | ||||
| } | ||||
| export { path, smartpath, smartfile, smartrequest, smartstream }; | ||||
|   | ||||
							
								
								
									
										27
									
								
								test/test.ts
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								test/test.ts
									
									
									
									
									
								
							| @@ -5,11 +5,11 @@ import * as plugins from './plugins.js'; | ||||
| const testPaths = { | ||||
|   nogitDir: plugins.path.join( | ||||
|     plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), | ||||
|     '../.nogit/' | ||||
|     '../.nogit/', | ||||
|   ), | ||||
|   remoteDir: plugins.path.join( | ||||
|     plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), | ||||
|     '../.nogit/remote' | ||||
|     '../.nogit/remote', | ||||
|   ), | ||||
| }; | ||||
|  | ||||
| @@ -21,29 +21,32 @@ tap.preTask('should prepare .nogit dir', async () => { | ||||
|  | ||||
| tap.preTask('should prepare downloads', async (tools) => { | ||||
|   const response = await plugins.smartrequest.SmartRequest.create() | ||||
|       .url('https://verdaccio.lossless.digital/@pushrocks%2fwebsetup/-/websetup-2.0.14.tgz') | ||||
|       .get(); | ||||
|     .url( | ||||
|       'https://verdaccio.lossless.digital/@pushrocks%2fwebsetup/-/websetup-2.0.14.tgz', | ||||
|     ) | ||||
|     .get(); | ||||
|   const downloadedFile: Buffer = Buffer.from(await response.arrayBuffer()); | ||||
|   await plugins.smartfile.memory.toFs( | ||||
|     downloadedFile, | ||||
|     plugins.path.join(testPaths.nogitDir, 'test.tgz') | ||||
|     plugins.path.join(testPaths.nogitDir, 'test.tgz'), | ||||
|   ); | ||||
| }); | ||||
|  | ||||
| tap.test('should extract existing files on disk', async () => { | ||||
|   const testSmartarchive = await smartarchive.SmartArchive.fromArchiveUrl( | ||||
|     'https://verdaccio.lossless.digital/@pushrocks%2fwebsetup/-/websetup-2.0.14.tgz' | ||||
|     'https://verdaccio.lossless.digital/@pushrocks%2fwebsetup/-/websetup-2.0.14.tgz', | ||||
|   ); | ||||
|   await testSmartarchive.exportToFs(testPaths.nogitDir); | ||||
| }); | ||||
|  | ||||
| tap.skip.test('should extract a b2zip', async () => { | ||||
|   const dataUrl = 'https://daten.offeneregister.de/de_companies_ocdata.jsonl.bz2'; | ||||
|   const dataUrl = | ||||
|     'https://daten.offeneregister.de/de_companies_ocdata.jsonl.bz2'; | ||||
|   const testArchive = await smartarchive.SmartArchive.fromArchiveUrl(dataUrl); | ||||
|     await testArchive.exportToFs( | ||||
|       plugins.path.join(testPaths.nogitDir, 'de_companies_ocdata.jsonl'), | ||||
|       'data.jsonl', | ||||
|     ); | ||||
| }) | ||||
|   await testArchive.exportToFs( | ||||
|     plugins.path.join(testPaths.nogitDir, 'de_companies_ocdata.jsonl'), | ||||
|     'data.jsonl', | ||||
|   ); | ||||
| }); | ||||
|  | ||||
| await tap.start(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user