bruker-data-test
Advanced tools
Comparing version 0.3.0 to 0.4.0
# Changelog | ||
## [0.4.0](https://www.github.com/cheminfo/bruker-data-test/compare/v0.3.0...v0.4.0) (2022-10-03) | ||
### ⚠ BREAKING CHANGES | ||
* use FileCollection | ||
* update dependencies | ||
### Features | ||
* use FileCollection ([01fb6fb](https://www.github.com/cheminfo/bruker-data-test/commit/01fb6fb0651d8b326b8024f8329c62187969fc6a)) | ||
### Miscellaneous Chores | ||
* update dependencies ([7404a31](https://www.github.com/cheminfo/bruker-data-test/commit/7404a317fcb3a1ecd335c0c3915d5cd3ff3fbd5b)) | ||
## [0.3.0](https://www.github.com/cheminfo/bruker-data-test/compare/v0.2.1...v0.3.0) (2022-09-06) | ||
@@ -4,0 +21,0 @@ |
@@ -1,7 +0,7 @@ | ||
import { PartialFileList } from 'filelist-utils'; | ||
import { FileCollection } from 'filelist-utils'; | ||
export declare function getList(): Promise<string[]>; | ||
export declare function getFile(name: string): Promise<import("filelist-utils").PartialFile>; | ||
export declare function getFile(name: string): Promise<import("filelist-utils").FileCollectionItem>; | ||
export declare function getData(name: string): Promise<ArrayBuffer>; | ||
export declare function getZipped(): Promise<PartialFileList>; | ||
export declare function getCoffee(): Promise<PartialFileList>; | ||
export declare function getZipped(): Promise<FileCollection>; | ||
export declare function getCoffee(): Promise<FileCollection>; | ||
//# sourceMappingURL=index.d.ts.map |
import { join } from 'path'; | ||
import { fileListFromPath } from 'filelist-utils'; | ||
import { fileCollectionFromPath } from 'filelist-utils'; | ||
const root = join(__dirname, '../data'); | ||
const PATH_TO_ZIPPEED = join(root, 'zipped'); | ||
const PATH_TO_ZIPPED = join(root, 'zipped'); | ||
const PATH_TO_COFFEE = join(root, 'flat/coffee'); | ||
const cache = {}; | ||
async function loadFileList(path) { | ||
async function loadFileCollection(path) { | ||
if (cache[path]) { | ||
return cache[path]; | ||
} | ||
cache[path] = await fileListFromPath(path, { | ||
cache[path] = await fileCollectionFromPath(path, { | ||
unzip: { zipExtensions: [] }, | ||
@@ -18,8 +18,8 @@ ungzip: { gzipExtensions: [] }, | ||
export async function getList() { | ||
const files = await loadFileList(PATH_TO_ZIPPEED); | ||
return files.map((d) => d.name); | ||
const fileCollection = await loadFileCollection(PATH_TO_ZIPPED); | ||
return fileCollection.files.map((d) => d.name); | ||
} | ||
export async function getFile(name) { | ||
const fileList = await loadFileList(PATH_TO_ZIPPEED); | ||
const file = fileList.find((file) => file.name === name); | ||
const fileCollection = await loadFileCollection(PATH_TO_ZIPPED); | ||
const file = fileCollection.files.find((file) => file.name === name); | ||
if (!file) { | ||
@@ -35,7 +35,7 @@ throw new Error(`There is not a zip file for ${name}`); | ||
export function getZipped() { | ||
return loadFileList(PATH_TO_ZIPPEED); | ||
return loadFileCollection(PATH_TO_ZIPPED); | ||
} | ||
export function getCoffee() { | ||
return loadFileList(PATH_TO_COFFEE); | ||
return loadFileCollection(PATH_TO_COFFEE); | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -1,7 +0,7 @@ | ||
import { PartialFileList } from 'filelist-utils'; | ||
import { FileCollection } from 'filelist-utils'; | ||
export declare function getList(): Promise<string[]>; | ||
export declare function getFile(name: string): Promise<import("filelist-utils").PartialFile>; | ||
export declare function getFile(name: string): Promise<import("filelist-utils").FileCollectionItem>; | ||
export declare function getData(name: string): Promise<ArrayBuffer>; | ||
export declare function getZipped(): Promise<PartialFileList>; | ||
export declare function getCoffee(): Promise<PartialFileList>; | ||
export declare function getZipped(): Promise<FileCollection>; | ||
export declare function getCoffee(): Promise<FileCollection>; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,10 +7,10 @@ "use strict"; | ||
const root = (0, path_1.join)(__dirname, '../data'); | ||
const PATH_TO_ZIPPEED = (0, path_1.join)(root, 'zipped'); | ||
const PATH_TO_ZIPPED = (0, path_1.join)(root, 'zipped'); | ||
const PATH_TO_COFFEE = (0, path_1.join)(root, 'flat/coffee'); | ||
const cache = {}; | ||
async function loadFileList(path) { | ||
async function loadFileCollection(path) { | ||
if (cache[path]) { | ||
return cache[path]; | ||
} | ||
cache[path] = await (0, filelist_utils_1.fileListFromPath)(path, { | ||
cache[path] = await (0, filelist_utils_1.fileCollectionFromPath)(path, { | ||
unzip: { zipExtensions: [] }, | ||
@@ -22,9 +22,9 @@ ungzip: { gzipExtensions: [] }, | ||
async function getList() { | ||
const files = await loadFileList(PATH_TO_ZIPPEED); | ||
return files.map((d) => d.name); | ||
const fileCollection = await loadFileCollection(PATH_TO_ZIPPED); | ||
return fileCollection.files.map((d) => d.name); | ||
} | ||
exports.getList = getList; | ||
async function getFile(name) { | ||
const fileList = await loadFileList(PATH_TO_ZIPPEED); | ||
const file = fileList.find((file) => file.name === name); | ||
const fileCollection = await loadFileCollection(PATH_TO_ZIPPED); | ||
const file = fileCollection.files.find((file) => file.name === name); | ||
if (!file) { | ||
@@ -42,9 +42,9 @@ throw new Error(`There is not a zip file for ${name}`); | ||
function getZipped() { | ||
return loadFileList(PATH_TO_ZIPPEED); | ||
return loadFileCollection(PATH_TO_ZIPPED); | ||
} | ||
exports.getZipped = getZipped; | ||
function getCoffee() { | ||
return loadFileList(PATH_TO_COFFEE); | ||
return loadFileCollection(PATH_TO_COFFEE); | ||
} | ||
exports.getCoffee = getCoffee; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "bruker-data-test", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Provides bruker NMR data files for testing purposes", | ||
@@ -40,14 +40,14 @@ "main": "./lib/index.js", | ||
"devDependencies": { | ||
"@types/jest": "^27.4.1", | ||
"eslint": "^8.10.0", | ||
"eslint-config-cheminfo-typescript": "^10.3.0", | ||
"jest": "^27.5.1", | ||
"prettier": "^2.5.1", | ||
"@types/jest": "^29.1.1", | ||
"eslint": "^8.24.0", | ||
"eslint-config-cheminfo-typescript": "^11.1.0", | ||
"jest": "^29.1.2", | ||
"prettier": "^2.7.1", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^27.1.3", | ||
"typescript": "^4.6.2" | ||
"ts-jest": "^29.0.3", | ||
"typescript": "^4.8.4" | ||
}, | ||
"dependencies": { | ||
"filelist-utils": "^0.7.1" | ||
"filelist-utils": "^0.11.0" | ||
} | ||
} |
import { join } from 'path'; | ||
import { fileListFromPath, PartialFileList } from 'filelist-utils'; | ||
import { fileCollectionFromPath, FileCollection } from 'filelist-utils'; | ||
const root = join(__dirname, '../data'); | ||
const PATH_TO_ZIPPEED = join(root, 'zipped'); | ||
const PATH_TO_ZIPPED = join(root, 'zipped'); | ||
const PATH_TO_COFFEE = join(root, 'flat/coffee'); | ||
const cache: Record<string, PartialFileList> = {}; | ||
const cache: Record<string, FileCollection> = {}; | ||
async function loadFileList(path: string) { | ||
async function loadFileCollection(path: string) { | ||
if (cache[path]) { | ||
@@ -16,3 +16,3 @@ return cache[path]; | ||
cache[path] = await fileListFromPath(path, { | ||
cache[path] = await fileCollectionFromPath(path, { | ||
unzip: { zipExtensions: [] }, | ||
@@ -26,9 +26,9 @@ ungzip: { gzipExtensions: [] }, | ||
export async function getList() { | ||
const files = await loadFileList(PATH_TO_ZIPPEED); | ||
return files.map((d) => d.name); | ||
const fileCollection = await loadFileCollection(PATH_TO_ZIPPED); | ||
return fileCollection.files.map((d) => d.name); | ||
} | ||
export async function getFile(name: string) { | ||
const fileList = await loadFileList(PATH_TO_ZIPPEED); | ||
const file = fileList.find((file) => file.name === name); | ||
const fileCollection = await loadFileCollection(PATH_TO_ZIPPED); | ||
const file = fileCollection.files.find((file) => file.name === name); | ||
@@ -48,7 +48,7 @@ if (!file) { | ||
export function getZipped() { | ||
return loadFileList(PATH_TO_ZIPPEED); | ||
return loadFileCollection(PATH_TO_ZIPPED); | ||
} | ||
export function getCoffee() { | ||
return loadFileList(PATH_TO_COFFEE); | ||
return loadFileCollection(PATH_TO_COFFEE); | ||
} |
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
74356974
+ Addedcross-fetch@3.1.8(transitive)
+ Addedfilelist-utils@0.11.0(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
- Removedfilelist-utils@0.7.1(transitive)
Updatedfilelist-utils@^0.11.0