New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

machinepack-fs

Package Overview
Dependencies
Maintainers
5
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

machinepack-fs - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

machines/ensure-json.js

2

machines/ensure-dir.js

@@ -7,3 +7,3 @@ module.exports = {

description: 'Ensures that the directory exists. If the directory structure does not exist, it is created.',
description: 'Ensure that the directory exists. If the directory structure does not exist, it is created.',

@@ -10,0 +10,0 @@

@@ -6,2 +6,3 @@ module.exports = {

cacheable: true,
idempotent: true,

@@ -8,0 +9,0 @@ inputs: {

module.exports = {
friendlyName: 'Read file',
description: 'Read file located at source path on disk into a string.',
extendedDescription: 'Assumes file is encoded using utf8.',
description: 'Read a file on disk as a string.',
extendedDescription: 'Assumes file contents are encoded using utf8.',
cacheable: true,
idempotent: true,
inputs: {
source: {

@@ -13,12 +26,12 @@ description: 'Absolute path to the source file (if relative path is provided, will resolve path from current working directory)',

}
},
defaultExit: 'success',
catchallExit: 'error',
exits: {
error: {},
doesNotExist: {
description: 'No file exists at the provided `source` path'
},
success: {

@@ -28,4 +41,6 @@ example: 'stuff in a file!',

}
},
fn: function (inputs, exits) {

@@ -36,12 +51,14 @@

fs.readFile(inputs.source, 'utf8', function (err, contents) {
if (err) {
if (typeof err === 'object' && err.code === 'ENOENT') {
return exits.doesNotExist();
}
// Some unrecognized error
return exits.error(err);
// It worked!
if (!err) {
return exits.success(contents);
}
return exits.success(contents);
// No need for `null` check here because we already know `err` is falsy
if (typeof err === 'object' && err.code === 'ENOENT') {
return exits.doesNotExist();
}
// Some unrecognized error
return exits.error(err);
});
}
};
{
"name": "machinepack-fs",
"version": "2.2.0",
"version": "2.3.0",
"description": "Work with the local filesystem; list files, write files, etc.",

@@ -47,3 +47,4 @@ "scripts": {

"ensure-dir",
"get-home-dirpath"
"get-home-dirpath",
"ensure-json"
],

@@ -50,0 +51,0 @@ "testsUrl": "https://travis-ci.org/mikermcneil/machinepack-fs"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc