filelist-from
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -0,1 +1,2 @@ | ||
declare type PartialFileList = Omit<File, 'stream' | 'slice' | 'type'>[]; | ||
/** | ||
@@ -6,3 +7,4 @@ * Generate a FileList from a directory path | ||
*/ | ||
export declare function fileListFromPath(path: string): File[]; | ||
export declare function fileListFromPath(path: string): PartialFileList; | ||
export {}; | ||
//# sourceMappingURL=fileListFromPath.d.ts.map |
@@ -23,3 +23,2 @@ import { readdirSync, statSync } from 'fs'; | ||
else { | ||
// @ts-expect-error We didn't implement all the requires properties | ||
fileList.push({ | ||
@@ -26,0 +25,0 @@ name: entry, |
import JSZip from 'jszip'; | ||
declare type ZipFile = Parameters<typeof JSZip.loadAsync>[0]; | ||
export declare type ZipFileContent = Parameters<typeof JSZip.loadAsync>[0]; | ||
/** | ||
@@ -8,6 +8,6 @@ * Create a FileList from a zip | ||
*/ | ||
export declare function fileListFromZip(zipContent: ZipFile): Promise<{ | ||
export declare function fileListFromZip(zipContent: ZipFileContent): Promise<{ | ||
name: string; | ||
webkitRelativePath: string; | ||
lastModified: Date; | ||
lastModified: number; | ||
size: any; | ||
@@ -17,3 +17,2 @@ text: () => Promise<string>; | ||
}[]>; | ||
export {}; | ||
//# sourceMappingURL=fileListFromZip.d.ts.map |
@@ -18,3 +18,3 @@ import JSZip from 'jszip'; | ||
webkitRelativePath: entry.name.replace(/\/.*?$/, ''), | ||
lastModified: new Date(entry.date), | ||
lastModified: entry.date.getTime(), | ||
// @ts-expect-error _data is not exposed because missing for folder but it is really there | ||
@@ -21,0 +21,0 @@ size: entry._data.uncompressedSize, |
@@ -0,1 +1,2 @@ | ||
declare type PartialFileList = Omit<File, 'stream' | 'slice' | 'type'>[]; | ||
/** | ||
@@ -6,3 +7,4 @@ * Generate a FileList from a directory path | ||
*/ | ||
export declare function fileListFromPath(path: string): File[]; | ||
export declare function fileListFromPath(path: string): PartialFileList; | ||
export {}; | ||
//# sourceMappingURL=fileListFromPath.d.ts.map |
@@ -27,3 +27,2 @@ "use strict"; | ||
else { | ||
// @ts-expect-error We didn't implement all the requires properties | ||
fileList.push({ | ||
@@ -30,0 +29,0 @@ name: entry, |
import JSZip from 'jszip'; | ||
declare type ZipFile = Parameters<typeof JSZip.loadAsync>[0]; | ||
export declare type ZipFileContent = Parameters<typeof JSZip.loadAsync>[0]; | ||
/** | ||
@@ -8,6 +8,6 @@ * Create a FileList from a zip | ||
*/ | ||
export declare function fileListFromZip(zipContent: ZipFile): Promise<{ | ||
export declare function fileListFromZip(zipContent: ZipFileContent): Promise<{ | ||
name: string; | ||
webkitRelativePath: string; | ||
lastModified: Date; | ||
lastModified: number; | ||
size: any; | ||
@@ -17,3 +17,2 @@ text: () => Promise<string>; | ||
}[]>; | ||
export {}; | ||
//# sourceMappingURL=fileListFromZip.d.ts.map |
@@ -24,3 +24,3 @@ "use strict"; | ||
webkitRelativePath: entry.name.replace(/\/.*?$/, ''), | ||
lastModified: new Date(entry.date), | ||
lastModified: entry.date.getTime(), | ||
// @ts-expect-error _data is not exposed because missing for folder but it is really there | ||
@@ -27,0 +27,0 @@ size: entry._data.uncompressedSize, |
{ | ||
"name": "filelist-from", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Create a FileList from a path or a zip file", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -5,2 +5,4 @@ import { readdirSync, statSync } from 'fs'; | ||
type PartialFileList = Omit<File, 'stream' | 'slice' | 'type'>[]; | ||
/** | ||
@@ -12,3 +14,3 @@ * Generate a FileList from a directory path | ||
export function fileListFromPath(path: string) { | ||
const fileList: File[] = []; | ||
const fileList: PartialFileList = []; | ||
appendFiles(fileList, path); | ||
@@ -18,3 +20,3 @@ return fileList; | ||
function appendFiles(fileList: File[], currentDir: string) { | ||
function appendFiles(fileList: PartialFileList, currentDir: string) { | ||
const entries = readdirSync(currentDir); | ||
@@ -27,3 +29,2 @@ for (let entry of entries) { | ||
} else { | ||
// @ts-expect-error We didn't implement all the requires properties | ||
fileList.push({ | ||
@@ -30,0 +31,0 @@ name: entry, |
import JSZip from 'jszip'; | ||
type ZipFile = Parameters<typeof JSZip.loadAsync>[0]; | ||
export type ZipFileContent = Parameters<typeof JSZip.loadAsync>[0]; | ||
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
export async function fileListFromZip(zipContent: ZipFile) { | ||
export async function fileListFromZip(zipContent: ZipFileContent) { | ||
const jsZip = new JSZip(); | ||
@@ -22,3 +22,3 @@ | ||
webkitRelativePath: entry.name.replace(/\/.*?$/, ''), | ||
lastModified: new Date(entry.date), | ||
lastModified: entry.date.getTime(), | ||
// @ts-expect-error _data is not exposed because missing for folder but it is really there | ||
@@ -25,0 +25,0 @@ size: entry._data.uncompressedSize, |
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
31947