formacao
This commit is contained in:
+5
-10
@@ -40,9 +40,7 @@ const replaceSync = (opt, files) => {
|
||||
POSITION: for (position = 0; position < st.size; position += 512) {
|
||||
for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) {
|
||||
bytes = node_fs_1.default.readSync(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos);
|
||||
if (position === 0 &&
|
||||
headBuf[0] === 0x1f &&
|
||||
headBuf[1] === 0x8b) {
|
||||
if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b) {
|
||||
throw new Error('cannot append to compressed archives');
|
||||
}
|
||||
if (!bytes) {
|
||||
@@ -72,7 +70,7 @@ const replaceSync = (opt, files) => {
|
||||
try {
|
||||
node_fs_1.default.closeSync(fd);
|
||||
}
|
||||
catch (er) { }
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -103,16 +101,14 @@ const replaceAsync = (opt, files) => {
|
||||
let bufPos = 0;
|
||||
const headBuf = Buffer.alloc(512);
|
||||
const onread = (er, bytes) => {
|
||||
if (er || typeof bytes === 'undefined') {
|
||||
if (er || bytes === undefined) {
|
||||
return cb(er);
|
||||
}
|
||||
bufPos += bytes;
|
||||
if (bufPos < 512 && bytes) {
|
||||
return node_fs_1.default.read(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos, onread);
|
||||
}
|
||||
if (position === 0 &&
|
||||
headBuf[0] === 0x1f &&
|
||||
headBuf[1] === 0x8b) {
|
||||
if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b) {
|
||||
return cb(new Error('cannot append to compressed archives'));
|
||||
}
|
||||
// truncated header
|
||||
@@ -191,8 +187,7 @@ const addFilesSync = (p, files) => {
|
||||
p.end();
|
||||
};
|
||||
const addFilesAsync = async (p, files) => {
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = String(files[i]);
|
||||
for (const file of files) {
|
||||
if (file.charAt(0) === '@') {
|
||||
await (0, list_js_1.list)({
|
||||
file: node_path_1.default.resolve(String(p.cwd), file.slice(1)),
|
||||
|
||||
Reference in New Issue
Block a user