npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

nodefs-lite

v0.1.7

Published

Utilitas File System Node.js

Readme

nodefs-lite

nodefs-lite utilitas filesystem yang menyediakan API stabil berbasis fs dan fs/promises tanpa modifikasi, namun dengan tambahan helper modern untuk memudahkan banyak tugas umum.

📦 Ringan — hanya membungkus fungsi fs asli

Cepat — tanpa overhead tambahan

🔧 Modular — dapat di‐tree-shake

👌 Mudah digunakan — API seragam dan modern

Instalasi

npm install nodefs-lite

Penggunaan Dasar

import fs from 'nodefs-lite';

await fs.writeFile('hello.txt', 'Hello World!');
console.log('[readFileSync] isi file:', fs.readFileSync('hello.txt', 'utf8'));

API

accessSync(path) / access(path)

console.log('[accessSync] cek file.txt');
fs.accessSync('file.txt');
console.log('[access] cek file.txt');
await fs.access('file.txt');

appendFileSync(path, data) / appendFile(path, data)

console.log('[appendFileSync] tambah teks ke file.txt');
fs.appendFileSync('file.txt', 'Hello\n');
console.log('[appendFile] tambah teks ke file.txt');
await fs.appendFile('file.txt', 'Hello\n');

chmodSync(path, mode) / chmod(path, mode)

console.log('[chmodSync] ubah izin script.sh menjadi 755');
fs.chmodSync('script.sh', 0o755);
console.log('[chmod] ubah izin script.sh menjadi 755');
await fs.chmod('script.sh', 0o755);

chownSync(path, uid, gid) / chown(path, uid, gid)

console.log('[chownSync] ubah owner file.txt');
fs.chownSync('file.txt', 1000, 1000);
console.log('[chown] ubah owner file.txt');
await fs.chown('file.txt', 1000, 1000);

cpSync(src, dest) / cp(src, dest)

console.log('[cpSync] salin a.txt -> backup/a.txt');
fs.cpSync('a.txt', 'backup/a.txt');
console.log('[cp] salin a.txt -> backup/a.txt');
await fs.cp('a.txt', 'backup/a.txt');

existsSync(path) / exists(path)

console.log('[existsSync] cek config.json:', fs.existsSync('config.json'));
console.log('[exists] cek config.json:', await fs.exists('config.json'));

lstatSync(path) / lstat(path)

const info = fs.lstatSync('file.txt');
console.log('[lstatSync] info:', info.isFileSync());
const info = await fs.lstat('file.txt');
console.log('[lstat] info:', info.isFile());

mkdirSync(path, { recursive }) / mkdir(path, { recursive })

console.log('[mkdirSync] buat folder a/b/c');
fs.mkdirSync('a/b/c', { recursive: true });
console.log('[mkdir] buat folder a/b/c');
await fs.mkdir('a/b/c', { recursive: true });

mkdtempSync(prefix) / mkdtemp(prefix)

console.log('[mkdtempSync] buat folder tmp');
fs.mkdtempSync('tmp-');
console.log('[mkdtemp] buat folder tmp');
await fs.mkdtemp('tmp-');

readdirSync(dir) / readdir(dir)

console.log('[readdirSync] list folder:', fs.readdirSync('./'));
console.log('[readdir] list folder:', await fs.readdir('./'));

readFileSync(path, encoding) / readFile(path, encoding)

console.log('[readFileSync] isi:', fs.readFileSync('file.txt', 'utf8'));
console.log('[readFile] isi:', await fs.readFile('file.txt', 'utf8'));

readlinkSync(path) / readlink(path)

console.log('[readlinkSync] ->', fs.readlinkSync('symlink'));
console.log('[readlink] ->', await fs.readlink('symlink'));

realpathSync(path) / realpath(path)

console.log('[realpathSync] ->', fs.realpathSync('./'));
console.log('[realpath] ->', await fs.realpath('./'));

renameSync(old, new) / rename(old, new)

console.log('[renameSync] a.txt -> b.txt');
fs.renameSync('a.txt', 'b.txt');
console.log('[rename] a.txt -> b.txt');
await fs.rename('a.txt', 'b.txt');

rmSync(path, { recursive }) / rm(path, { recursive })

console.log('[rmSync] hapus dir');
fs.rmSync('dir', { recursive: true, force: true });
console.log('[rm] hapus dist');
await fs.rm('dist', { recursive: true, force: true });

rmdirSync(path) / rmdir(path)

console.log('[rmdirSync] hapus folder kosong');
fs.rmdirSync('empty');
console.log('[rmdir] hapus folder kosong');
await fs.rmdir('empty');

statSync(path) / stat(path)

console.log('[statSync]', fs.statSync('file.txt'));
console.log('[stat]', await fs.stat('file.txt'));

symlinkSync(target, path) / symlink(target, path)

console.log('[symlinkSync] buat symlink');
fs.symlinkSync('src.txt', 'link.txt');
console.log('[symlink] buat symlink');
await fs.symlink('src.txt', 'link.txt');

truncateSync(path) / truncate(path)

console.log('[truncateSync] kosongkan file.txt');
fs.truncateSync('file.txt', 0);
console.log('[truncate] kosongkan file.txt');
await fs.truncate('file.txt', 0);

unlinkSync(path) / unlink(path)

console.log('[unlinkSync] hapus temp.txt');
fs.unlinkSync('temp.txt');
console.log('[unlink] hapus temp.txt');
await fs.unlink('temp.txt');

utimesSync(path, atime, mtime) / utimes(path, atime, mtime)

console.log('[utimesSync] update times');
fs.utimesSync('file.txt', new Date(), new Date());
console.log('[utimes] update times');
await fs.utimes('file.txt', new Date(), new Date());

writeFileSync(path, data) / writeFile(path, data)

console.log('[writeFileSync] tulis file a.txt');
fs.writeFileSync('a.txt', 'Hello');
console.log('[writeFile] tulis file a.txt');
await fs.writeFile('a.txt', 'Hello');

createReadStream(path)

console.log('[createReadStream] streaming bigfile.txt');
const stream = fs.createReadStream('bigfile.txt');
stream.pipe(process.stdout);

createWriteStream(path)

console.log('[createWriteStream] tulis ke out.txt');
const out = fs.createWriteStream('out.txt');
out.write('Hello!');

constants

console.log('[constants]', fs.constants.O_RDWR);

isFileSync(path) / isFile(path)

console.log('[isFileSync]', fs.isFileSync('image.png'));
console.log('[isFile]', await fs.isFile('image.png'));

isDirSync(path) / isDir(path)

console.log('[isDirSync]', fs.isDirSync('node_modules'));
console.log('[isDir]', await fs.isDir('node_modules'));

ensureDirSync(path) / ensureDir(path)

console.log('[ensureDirSync] pastikan folder logs/data ada');
fs.ensureDirSync('logs/data');
console.log('[ensureDir] pastikan folder logs/data ada');
await fs.ensureDir('logs/data');

ensureFileSync(path) / ensureFile(path)

console.log('[ensureFileSync] buat file jika belum ada');
fs.ensureFileSync('data/config/app.json');
console.log('[ensureFile] buat file jika belum ada');
await fs.ensureFile('data/config/app.json');

ensureEmptyDirSync(path) / ensureEmptyDir(path)

console.log('[ensureEmptyDirSync] pastikan kosong');
fs.ensureEmptyDirSync('cache');
console.log('[ensureEmptyDir] pastikan kosong');
await fs.ensureEmptyDir('cache');

emptyDirSync(path) / emptyDir(path)

console.log('[emptyDirSync] kosongkan folder tmp');
fs.emptyDirSync('tmp');
console.log('[emptyDir] kosongkan folder tmp');
await fs.emptyDir('tmp');

readJsonSync(path) / readJson(path)

const data = fs.readJsonSync('config.json');
console.log('[readJsonSync]', data);
const data = await fs.readJson('config.json');
console.log('[readJson]', data);

writeJsonSync(path, data) / writeJson(path, data)

console.log('[writeJsonSync] tulis config.json');
fs.writeJsonSync('config.json', { name: 'app', version: '0.0.0' });
console.log('[writeJson] tulis config.json');
await fs.writeJson('config.json', { name: 'app', version: '0.0.0' });