
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
file-mock is a tool that will handle file's creation and deletion automatically for your tests.
You have to specify, which file in which location you want and file mock will create all directories and files.
const fmock = require('file-mock')
fmock.mock({
'server/uploads/test.png': 'File content',
'/path/to/file.jpg': 'File content',
'/path': {
'to': {
'myfile.png': 'File content'
},
'to1': {
'myfile.png': 'File content'
}
}
})
Warning
If your path starts with a /, it will let it like this. In this example we have
/path/to/file.jpg/path/to/myfile.jpg/path/to1/myfile.jpg
If it does not start with a /, the first part of the path will be the result of the process.cwd() function (usually the root of your repository).To restore as before, you can use the restore function.
fmock.restore()
This function will delete all files and directories that have been created by the mock function.
This will never remove a directory that already exists
FAQs
A module which handle all your files creation and deletion for your tests
The npm package file-mock receives a total of 5 weekly downloads. As such, file-mock popularity was classified as not popular.
We found that file-mock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.