Correct paths entering tarball
This commit is contained in:
parent
5c34244996
commit
ca33e18e5a
1 changed files with 1 additions and 3 deletions
4
index.js
4
index.js
|
@ -87,7 +87,6 @@ async function packDirectory(directory, options = {}) {
|
||||||
writeFirstEntry(options, tarPack);
|
writeFirstEntry(options, tarPack);
|
||||||
|
|
||||||
await walkAndRun(async (file) => {
|
await walkAndRun(async (file) => {
|
||||||
try{
|
|
||||||
contents = await readFile(path.normalize(file));
|
contents = await readFile(path.normalize(file));
|
||||||
|
|
||||||
// Must be chunked to avoid issues with fixed memory limits.
|
// Must be chunked to avoid issues with fixed memory limits.
|
||||||
|
@ -113,7 +112,7 @@ async function packDirectory(directory, options = {}) {
|
||||||
|
|
||||||
contents = zstd.compressChunks(chunkIterator, contents.length, COMPRESSION_LEVEL);
|
contents = zstd.compressChunks(chunkIterator, contents.length, COMPRESSION_LEVEL);
|
||||||
|
|
||||||
let name = path.relative(packRoot, file);
|
let name = path.relative(packRoot, file).replace('\\', '/');
|
||||||
|
|
||||||
if(/^\.\//.test(name)) {
|
if(/^\.\//.test(name)) {
|
||||||
name = name.slice(2);
|
name = name.slice(2);
|
||||||
|
@ -128,7 +127,6 @@ async function packDirectory(directory, options = {}) {
|
||||||
await writeStream(entry, contents);
|
await writeStream(entry, contents);
|
||||||
|
|
||||||
entry.end();
|
entry.end();
|
||||||
}catch (e){console.log(e)}
|
|
||||||
}, directory, packRoot);
|
}, directory, packRoot);
|
||||||
tarPack.finalize();
|
tarPack.finalize();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue