fix: maintain unix file permissions from file read to zip options (#14)
This commit is contained in:
parent
3a2984409e
commit
b22675cef9
1 changed files with 33 additions and 6 deletions
|
|
@ -176,15 +176,19 @@ export function getAllFiles(
|
|||
return fileList;
|
||||
}
|
||||
|
||||
interface FileWithPermissions {
|
||||
data: Uint8Array;
|
||||
mode: number;
|
||||
}
|
||||
export interface GetAllFilesResult {
|
||||
files: Record<string, Uint8Array>;
|
||||
files: Record<string, FileWithPermissions>;
|
||||
ignoredCount: number;
|
||||
}
|
||||
|
||||
export function getAllFilesWithCount(
|
||||
dirPath: string,
|
||||
baseDir: string = dirPath,
|
||||
fileList: Record<string, Uint8Array> = {},
|
||||
fileList: Record<string, FileWithPermissions> = {},
|
||||
additionalPatterns: string[] = [],
|
||||
ignoredCount = 0,
|
||||
): GetAllFilesResult {
|
||||
|
|
@ -213,7 +217,10 @@ export function getAllFilesWithCount(
|
|||
} else {
|
||||
// Use forward slashes in zip file paths
|
||||
const zipPath = relativePath.split(sep).join("/");
|
||||
fileList[zipPath] = readFileSync(filePath);
|
||||
fileList[zipPath] = {
|
||||
data: readFileSync(filePath),
|
||||
mode: stat.mode,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue