File Explorer

/proc/4/root/var/lang/lib/node_modules/npm/node_modules/libnpmversion/lib

This explorer reads the filesystem of the server it runs on, so /workspace/user isn't present here. Browsing and the terminal still work against this server's own disk from /.

write-json.js483 B · 16 lines
// write the json back, preserving the line breaks and indentconst { writeFile } = require('node:fs/promises')const kIndent = Symbol.for('indent')const kNewline = Symbol.for('newline') module.exports = async (path, pkg) => {  const {    [kIndent]: indent = 2,    [kNewline]: newline = '\n',  } = pkg  delete pkg._id  const raw = JSON.stringify(pkg, null, indent) + '\n'  const data = newline === '\n' ? raw : raw.split('\n').join(newline)  return writeFile(path, data)}