pic-js-mops
Version:
An Internet Computer Protocol canister testing library for TypeScript and JavaScript.
22 lines • 617 B
JavaScript
import { access, constants, readFile } from 'node:fs/promises';
import { resolve } from 'node:path';
import { tmpdir } from 'node:os';
export async function exists(filePath) {
try {
await access(filePath, constants.F_OK);
return true;
}
catch (e) {
return false;
}
}
export function tmpFile(filePath) {
return resolve(tmpdir(), filePath);
}
export async function readFileAsBytes(filePath) {
return await readFile(filePath);
}
export async function readFileAsString(filePath) {
return await readFile(filePath, { encoding: 'utf-8' });
}
//# sourceMappingURL=fs.js.map