filelist-utils
Advanced tools
Comparing version 1.8.1 to 1.9.0
@@ -0,1 +1,2 @@ | ||
import { CacheOptions } from './CachedFileCollectionItem'; | ||
import { ExpandOptions } from './ExpandOptions'; | ||
@@ -17,3 +18,3 @@ import { FileCollection } from './FileCollection'; | ||
baseURL?: string | URL; | ||
} & ExpandOptions & FilterOptions): Promise<FileCollection>; | ||
} & CacheOptions & ExpandOptions & FilterOptions): Promise<FileCollection>; | ||
//# sourceMappingURL=fileCollectionFromWebSource.d.ts.map |
import fetch from 'cross-fetch'; | ||
import { CachedFileCollectionItem, } from './CachedFileCollectionItem'; | ||
import { FileCollection } from './FileCollection'; | ||
@@ -17,3 +18,3 @@ import { maybeExpand } from './utilities/maybeExpand'; | ||
export async function fileCollectionFromWebSource(source, options = {}) { | ||
const { baseURL } = options; | ||
const { baseURL, cache = false } = options; | ||
let fileCollectionItems = []; | ||
@@ -48,3 +49,3 @@ const existing = {}; | ||
const fileURL = new URL(entry.relativePath, realBaseURL); | ||
fileCollectionItems.push({ | ||
const filecollectionItem = { | ||
name: entry.relativePath.split('/').pop() || '', | ||
@@ -65,3 +66,6 @@ size, | ||
}, | ||
}); | ||
}; | ||
fileCollectionItems.push(cache | ||
? new CachedFileCollectionItem(filecollectionItem) | ||
: filecollectionItem); | ||
} | ||
@@ -68,0 +72,0 @@ fileCollectionItems = await maybeExpand(fileCollectionItems, options); |
@@ -0,1 +1,2 @@ | ||
import { CacheOptions } from './CachedFileCollectionItem'; | ||
import { ExpandOptions } from './ExpandOptions'; | ||
@@ -17,3 +18,3 @@ import { FileCollection } from './FileCollection'; | ||
baseURL?: string | URL; | ||
} & ExpandOptions & FilterOptions): Promise<FileCollection>; | ||
} & CacheOptions & ExpandOptions & FilterOptions): Promise<FileCollection>; | ||
//# sourceMappingURL=fileCollectionFromWebSource.d.ts.map |
@@ -8,2 +8,3 @@ "use strict"; | ||
const cross_fetch_1 = __importDefault(require("cross-fetch")); | ||
const CachedFileCollectionItem_1 = require("./CachedFileCollectionItem"); | ||
const FileCollection_1 = require("./FileCollection"); | ||
@@ -24,3 +25,3 @@ const maybeExpand_1 = require("./utilities/maybeExpand"); | ||
async function fileCollectionFromWebSource(source, options = {}) { | ||
const { baseURL } = options; | ||
const { baseURL, cache = false } = options; | ||
let fileCollectionItems = []; | ||
@@ -55,3 +56,3 @@ const existing = {}; | ||
const fileURL = new URL(entry.relativePath, realBaseURL); | ||
fileCollectionItems.push({ | ||
const filecollectionItem = { | ||
name: entry.relativePath.split('/').pop() || '', | ||
@@ -72,3 +73,6 @@ size, | ||
}, | ||
}); | ||
}; | ||
fileCollectionItems.push(cache | ||
? new CachedFileCollectionItem_1.CachedFileCollectionItem(filecollectionItem) | ||
: filecollectionItem); | ||
} | ||
@@ -75,0 +79,0 @@ fileCollectionItems = await (0, maybeExpand_1.maybeExpand)(fileCollectionItems, options); |
{ | ||
"name": "filelist-utils", | ||
"version": "1.8.1", | ||
"version": "1.9.0", | ||
"description": "Create a FileCollection from a path or a zip file", | ||
@@ -48,15 +48,15 @@ "main": "./lib/index.js", | ||
"devDependencies": { | ||
"@babel/plugin-transform-modules-commonjs": "^7.20.11", | ||
"@babel/preset-typescript": "^7.18.6", | ||
"@types/jest": "^29.4.0", | ||
"@babel/plugin-transform-modules-commonjs": "^7.21.5", | ||
"@babel/preset-typescript": "^7.21.5", | ||
"@types/jest": "^29.5.1", | ||
"@types/pako": "^2.0.0", | ||
"cheminfo-build": "^1.2.0", | ||
"eslint": "^8.34.0", | ||
"eslint-config-cheminfo-typescript": "^11.2.2", | ||
"jest": "^29.4.3", | ||
"msw": "^1.0.1", | ||
"prettier": "^2.8.4", | ||
"rimraf": "^4.1.2", | ||
"typescript": "^4.9.5", | ||
"undici": "^5.19.1" | ||
"eslint": "^8.40.0", | ||
"eslint-config-cheminfo-typescript": "^11.3.1", | ||
"jest": "^29.5.0", | ||
"msw": "^1.2.1", | ||
"prettier": "^2.8.8", | ||
"rimraf": "^5.0.0", | ||
"typescript": "^5.0.4", | ||
"undici": "^5.22.1" | ||
}, | ||
@@ -63,0 +63,0 @@ "dependencies": { |
import fetch from 'cross-fetch'; | ||
import { | ||
CacheOptions, | ||
CachedFileCollectionItem, | ||
} from './CachedFileCollectionItem'; | ||
import { ExpandOptions } from './ExpandOptions'; | ||
@@ -23,5 +27,8 @@ import { FileCollection } from './FileCollection'; | ||
source: WebSource, | ||
options: { baseURL?: string | URL } & ExpandOptions & FilterOptions = {}, | ||
options: { baseURL?: string | URL } & CacheOptions & | ||
ExpandOptions & | ||
FilterOptions = {}, | ||
): Promise<FileCollection> { | ||
const { baseURL } = options; | ||
const { baseURL, cache = false } = options; | ||
let fileCollectionItems: FileCollectionItem[] = []; | ||
@@ -60,3 +67,3 @@ | ||
const fileURL = new URL(entry.relativePath, realBaseURL); | ||
fileCollectionItems.push({ | ||
const filecollectionItem = { | ||
name: entry.relativePath.split('/').pop() || '', | ||
@@ -77,3 +84,8 @@ size, | ||
}, | ||
}); | ||
}; | ||
fileCollectionItems.push( | ||
cache | ||
? new CachedFileCollectionItem(filecollectionItem) | ||
: filecollectionItem, | ||
); | ||
} | ||
@@ -80,0 +92,0 @@ fileCollectionItems = await maybeExpand(fileCollectionItems, options); |
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
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
168300
920
210
2661