remove dead code

This commit is contained in:
Simon Knott 2025-01-30 13:15:45 +01:00
parent 6fb53553e7
commit 3c6375670f
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -9,19 +9,6 @@ exports.decodeLongPath = function decodeLongPath (buf, encoding) {
return decodeStr(buf, 0, buf.length, encoding) return decodeStr(buf, 0, buf.length, encoding)
} }
exports.encodePax = function encodePax (opts) { // TODO: encode more stuff in pax
let result = ''
if (opts.name) result += addLength(' path=' + opts.name + '\n')
if (opts.linkname) result += addLength(' linkpath=' + opts.linkname + '\n')
const pax = opts.pax
if (pax) {
for (const key in pax) {
result += addLength(' ' + key + '=' + pax[key] + '\n')
}
}
return Buffer.from(result)
}
exports.decodePax = function decodePax (buf) { exports.decodePax = function decodePax (buf) {
const result = {} const result = {}
@ -215,11 +202,3 @@ function decodeOct (val, offset, length) {
function decodeStr (val, offset, length, encoding) { function decodeStr (val, offset, length, encoding) {
return val.toString(encoding, offset, indexOf(val, 0, offset, offset + length)) return val.toString(encoding, offset, indexOf(val, 0, offset, offset + length))
} }
function addLength (str) {
const len = Buffer.byteLength(str)
let digits = Math.floor(Math.log(len) / Math.log(10)) + 1
if (len + digits >= Math.pow(10, digits)) digits++
return (len + digits) + str
}