ipfs-http-client
Version:
A client library for the IPFS HTTP API
28 lines (20 loc) • 511 B
JavaScript
const toCamel = require('./object-to-camel')
/**
* @param {Record<string, any>} entry
*/
function toCamelWithMetadata (entry) {
const file = toCamel(entry)
if (Object.prototype.hasOwnProperty.call(file, 'mode')) {
file.mode = parseInt(file.mode, 8)
}
if (Object.prototype.hasOwnProperty.call(file, 'mtime')) {
file.mtime = {
secs: file.mtime,
nsecs: file.mtimeNsecs || 0
}
delete file.mtimeNsecs
}
return file
}
module.exports = toCamelWithMetadata