publint0.3.25911 B
import fs from 'node:fs'
import fsp from 'node:fs/promises'
import nodePath from 'node:path'
/**
* Creates a node-compatible Vfs object
* @returns {import('../shared/core.js').Vfs}
*/
export function createNodeVfs() {
return {
async readFile(path) {
return await fsp.readFile(path, 'utf8')
},
async readDir(path) {
return await fsp.readdir(path)
},
async isPathDir(path) {
try {
return (await fsp.stat(path)).isDirectory()
} catch {
return false
}
},
async isPathExist(path) {
return fs.existsSync(path)
},
pathJoin(...parts) {
return nodePath.join(...parts)
},
pathRelative(from, to) {
return nodePath.relative(from, to).replaceAll(nodePath.sep, '/')
},
getDirName(path) {
return nodePath.dirname(path)
},
getExtName(path) {
return nodePath.extname(path)
},
}
}
Shown as plain text from the published tarball, after apm checked it against the version's checksum. Nothing in it runs on this page.