mock-fs
fs-extra
mock-fs | fs-extra | |
---|---|---|
2 | 16 | |
896 | 9,348 | |
- | - | |
0.0 | 5.6 | |
7 months ago | about 2 months ago | |
JavaScript | JavaScript | |
GNU General Public License v3.0 or later | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
mock-fs
-
How to Write File-Based Tests With Real Files
A lot of my past projects in some way had to do with file access. I started to test with mocking libraries like mock-fs, but soon recognized that they do not work for all cases, and sometimes you are using third party libraries internally that you cannot mock easily. So I thought of a different solution and the one I'm using right now for most projects actually uses real files.
-
Unit testing Node.js fs with mock-fs
In this post I'll be showing you how you can use mock-fs to easily unit test your Node.js scripts.
fs-extra
-
What are some of the best libraries you cannot work without?
I haven't seen fs-extra mentioned yet. For my work it involves a fair bit of reading/writing to the filesystem, so this makes it quite nice to deal with everything in an async way.
-
mkdirp module problem
There are a number of these modules, https://github.com/jprichardson/node-fs-extra being probably the most famous / popular. It does a better job of explaining the why.
-
Re-release fs-extra to properly support esm/cjs usage
Since updating nodejs@18 and switching to esm only, many libraries have been replaced to support esm import, but fs-extra has not been The use of esm is correctly supported, and no suitable replacement has been found. After the a PR proposed by us was rejected, I decided to re-release a [fs-extra-unified] that correctly supports the use of esm (https://www.npmjs.com/package/fs-extra-unified) module.
- Создаем React-компоненты иконок с помощью Figma API и SVGR. Часть 1.
-
Is it just me or after updating Foundry sucks?
Are you seriously suggesting the creators of the software can't write a "save elsewhere" function using Electron and JavaScript? The system has versioning so it would be easy to ask the user to create a backup on first loading with a new version of the software, and the copySync function to make a backup. Foundry uses Node.js already.
-
Node.js for GIS: from google locations to GeoJSON using Streams
We are dealing with a file that is far too large to be loaded into memory at once. Node cannot buffer the file for us because of the size of it.
-
Implement cool features for my static site generator
Implementing those 3 features was quite simple. For metadata and markdown file, I mainly used an external library: showdown to convert from markdown files to html files as well as parsing metadata from markdown files. However, implementing the support for static assets such as images is a bit more interesting. I had to use another external library called fs-extra to copy assets folder from user to the dist folder. I also had to create another new class called CopyFolder where I used fs.copy method to copy assets folder
-
Writing JS-based Bash scripts with zx
The zx project implements a shell script executor similar to Bash but using JavaScript modules. It provides an inbuilt asynchronous JavaScript API to call other commands similar to Bash. Besides that, it provides wrapper functions for several Node.js-based command-line helpers such as chalk, minimist, fs-extra, OS, and Readline.
-
Why Storing Files in the Database Is Considered Bad Practice
Node.js has the built-in fs module (fs/promises with async/await) which makes it easy to interact with the file system. On top of that, there are a few convenient libraries such as fs-extra and findit that make common tasks straightforward.
-
Batch with Node.js
For this purpose we'll use fs-extra since copy/paste seems like not supported by fs API.
What are some alternatives?
jest - Delightful JavaScript Testing.
graceful-fs - fs with incremental backoff on EMFILE
mocha - ☕️ simple, flexible, fun javascript test framework for node.js & the browser
rimraf - A `rm -rf` util for nodejs
output-files - Output a tree of files and directories by providing an object. Especially useful for testing with real files.
fs-jetpack - Better file system API for Node.js
with-local-tmp-dir - Creates a temporary folder inside cwd, cds inside the folder, runs a function, and removes the folder. Especially useful for testing.
chokidar - Minimal and efficient cross-platform file watching library
endent - ⬅️ An ES6 string tag makes indentation better
mkdirp - Recursively mkdir, like `mkdir -p`, but in node.js
write-json-file - Stringify and write JSON to a file atomically
globby - User-friendly glob matching