filelist-utils
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -47,5 +47,3 @@ import { createReadStream } from 'node:fs'; | ||
} | ||
else { | ||
throw new Error('The stream() method is only supported in Node.js >= 18.0.0'); | ||
} | ||
throw new Error('The stream() method is only supported in Node.js >= 18.0.0'); | ||
}, | ||
@@ -52,0 +50,0 @@ }); |
@@ -0,3 +1,4 @@ | ||
/// <reference types="node" /> | ||
import { FileCollectionItem } from './FileCollectionItem'; | ||
export declare function ungzipStream(file: FileCollectionItem): any; | ||
export declare function ungzipStream(file: FileCollectionItem): import("stream/web").ReadableStream<any>; | ||
//# sourceMappingURL=ungzipStream.d.ts.map |
@@ -0,6 +1,11 @@ | ||
import { ReadStream } from 'fs'; | ||
import { createGunzip } from 'zlib'; | ||
export function ungzipStream(file) { | ||
//@ts-expect-error Should fix this definition | ||
return file.stream().pipe(createGunzip()); | ||
if (ReadStream.toWeb) { | ||
return ReadStream.toWeb( | ||
//@ts-expect-error Should fix this definition | ||
ReadStream.fromWeb(file.stream()).pipe(createGunzip())); | ||
} | ||
throw new Error('The stream() method is only supported in Node.js >= 18.0.0'); | ||
} | ||
//# sourceMappingURL=ungzipStream.js.map |
@@ -26,4 +26,18 @@ import { join } from 'path'; | ||
`); | ||
if (parseInt(process.versions.node) >= 18) { | ||
const stream = fileCollectionUngzipped[1].stream(); | ||
const results = []; | ||
//@ts-expect-error feature is too new | ||
for await (let chunk of stream) { | ||
results.push(chunk); | ||
} | ||
expect(new Uint8Array(results[0])[0]).toBe(98); | ||
} | ||
else { | ||
expect(() => { | ||
fileCollectionUngzipped[1].stream(); | ||
}).toThrow(''); | ||
} | ||
}); | ||
}); | ||
//# sourceMappingURL=fileCollectionItemsUngzip.test.js.map |
@@ -51,5 +51,3 @@ "use strict"; | ||
} | ||
else { | ||
throw new Error('The stream() method is only supported in Node.js >= 18.0.0'); | ||
} | ||
throw new Error('The stream() method is only supported in Node.js >= 18.0.0'); | ||
}, | ||
@@ -56,0 +54,0 @@ }); |
@@ -0,3 +1,4 @@ | ||
/// <reference types="node" /> | ||
import { FileCollectionItem } from './FileCollectionItem'; | ||
export declare function ungzipStream(file: FileCollectionItem): any; | ||
export declare function ungzipStream(file: FileCollectionItem): import("stream/web").ReadableStream<any>; | ||
//# sourceMappingURL=ungzipStream.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ungzipStream = void 0; | ||
const fs_1 = require("fs"); | ||
const zlib_1 = require("zlib"); | ||
function ungzipStream(file) { | ||
//@ts-expect-error Should fix this definition | ||
return file.stream().pipe((0, zlib_1.createGunzip)()); | ||
if (fs_1.ReadStream.toWeb) { | ||
return fs_1.ReadStream.toWeb( | ||
//@ts-expect-error Should fix this definition | ||
fs_1.ReadStream.fromWeb(file.stream()).pipe((0, zlib_1.createGunzip)())); | ||
} | ||
throw new Error('The stream() method is only supported in Node.js >= 18.0.0'); | ||
} | ||
exports.ungzipStream = ungzipStream; | ||
//# sourceMappingURL=ungzipStream.js.map |
@@ -28,4 +28,18 @@ "use strict"; | ||
`); | ||
if (parseInt(process.versions.node) >= 18) { | ||
const stream = fileCollectionUngzipped[1].stream(); | ||
const results = []; | ||
//@ts-expect-error feature is too new | ||
for await (let chunk of stream) { | ||
results.push(chunk); | ||
} | ||
expect(new Uint8Array(results[0])[0]).toBe(98); | ||
} | ||
else { | ||
expect(() => { | ||
fileCollectionUngzipped[1].stream(); | ||
}).toThrow(''); | ||
} | ||
}); | ||
}); | ||
//# sourceMappingURL=fileCollectionItemsUngzip.test.js.map |
{ | ||
"name": "filelist-utils", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Create a FileCollection from a path or a zip file", | ||
@@ -53,3 +53,3 @@ "main": "./lib/index.js", | ||
"eslint-config-cheminfo-typescript": "^11.1.0", | ||
"jest": "^29.1.2", | ||
"jest": "^29.2.0", | ||
"msw": "^0.47.4", | ||
@@ -56,0 +56,0 @@ "prettier": "^2.7.1", |
@@ -58,7 +58,6 @@ import { createReadStream } from 'node:fs'; | ||
return Readable.toWeb(createReadStream(current)); | ||
} else { | ||
throw new Error( | ||
'The stream() method is only supported in Node.js >= 18.0.0', | ||
); | ||
} | ||
throw new Error( | ||
'The stream() method is only supported in Node.js >= 18.0.0', | ||
); | ||
}, | ||
@@ -65,0 +64,0 @@ }); |
@@ -0,1 +1,2 @@ | ||
import { ReadStream } from 'fs'; | ||
import { createGunzip } from 'zlib'; | ||
@@ -6,4 +7,9 @@ | ||
export function ungzipStream(file: FileCollectionItem) { | ||
//@ts-expect-error Should fix this definition | ||
return file.stream().pipe(createGunzip()); | ||
if (ReadStream.toWeb) { | ||
return ReadStream.toWeb( | ||
//@ts-expect-error Should fix this definition | ||
ReadStream.fromWeb(file.stream()).pipe(createGunzip()), | ||
); | ||
} | ||
throw new Error('The stream() method is only supported in Node.js >= 18.0.0'); | ||
} |
@@ -38,3 +38,17 @@ import { join } from 'path'; | ||
`); | ||
if (parseInt(process.versions.node) >= 18) { | ||
const stream = fileCollectionUngzipped[1].stream(); | ||
const results = []; | ||
//@ts-expect-error feature is too new | ||
for await (let chunk of stream) { | ||
results.push(chunk); | ||
} | ||
expect(new Uint8Array(results[0])[0]).toBe(98); | ||
} else { | ||
expect(() => { | ||
fileCollectionUngzipped[1].stream(); | ||
}).toThrow(''); | ||
} | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
142641
2195
2