diff options
author | npm CLI robot <npm-cli+bot@github.com> | 2022-12-06 22:18:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-07 03:18:33 +0000 |
commit | 3bef54918b9a8fae42d24520e59214239b3a5386 (patch) | |
tree | f90509490c6880220938671346b2c2f644fd3d68 /deps/npm/node_modules/tar/lib/pax.js | |
parent | e70496f25508af8faa98717b9d90c9bcad8d767d (diff) | |
download | node-new-3bef54918b9a8fae42d24520e59214239b3a5386.tar.gz |
deps: upgrade npm to 9.1.3
PR-URL: https://github.com/nodejs/node/pull/45693
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruy Adorno <ruyadorno@google.com>
Diffstat (limited to 'deps/npm/node_modules/tar/lib/pax.js')
-rw-r--r-- | deps/npm/node_modules/tar/lib/pax.js | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/deps/npm/node_modules/tar/lib/pax.js b/deps/npm/node_modules/tar/lib/pax.js index 7768c7b454..4a7ca85386 100644 --- a/deps/npm/node_modules/tar/lib/pax.js +++ b/deps/npm/node_modules/tar/lib/pax.js @@ -24,8 +24,9 @@ class Pax { encode () { const body = this.encodeBody() - if (body === '') + if (body === '') { return null + } const bodyLen = Buffer.byteLength(body) // round up to 512 bytes @@ -34,8 +35,9 @@ class Pax { const buf = Buffer.allocUnsafe(bufLen) // 0-fill the header section, it might not hit every field - for (let i = 0; i < 512; i++) + for (let i = 0; i < 512; i++) { buf[i] = 0 + } new Header({ // XXX split the path @@ -60,8 +62,9 @@ class Pax { buf.write(body, 512, bodyLen, 'utf8') // null pad after the body - for (let i = bodyLen + 512; i < buf.length; i++) + for (let i = bodyLen + 512; i < buf.length; i++) { buf[i] = 0 + } return buf } @@ -87,8 +90,9 @@ class Pax { } encodeField (field) { - if (this[field] === null || this[field] === undefined) + if (this[field] === null || this[field] === undefined) { return '' + } const v = this[field] instanceof Date ? this[field].getTime() / 1000 : this[field] const s = ' ' + @@ -100,8 +104,9 @@ class Pax { // so if it's 9 characters, then adding 1 for the 9 makes it 10 // which makes it 11 chars. let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1 - if (byteLen + digits >= Math.pow(10, digits)) + if (byteLen + digits >= Math.pow(10, digits)) { digits += 1 + } const len = digits + byteLen return len + s } @@ -123,14 +128,16 @@ const parseKVLine = (set, line) => { // XXX Values with \n in them will fail this. // Refactor to not be a naive line-by-line parse. - if (n !== Buffer.byteLength(line) + 1) + if (n !== Buffer.byteLength(line) + 1) { return set + } - line = line.substr((n + ' ').length) + line = line.slice((n + ' ').length) const kv = line.split('=') const k = kv.shift().replace(/^SCHILY\.(dev|ino|nlink)/, '$1') - if (!k) + if (!k) { return set + } const v = kv.join('=') set[k] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) |