Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fsify

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fsify - npm Package Compare versions

Comparing version 0.0.1 to 1.0.0

src/get.js

12

package.json
{
"name": "fsify",
"version": "0.0.1",
"version": "1.0.0",
"authors": [

@@ -39,6 +39,10 @@ "Tobias Reich <tobias@electerious.com>"

"chai": "^3.5.0",
"coveralls": "^2.11.9",
"istanbul": "^0.4.4",
"mocha": "^3.0.0"
"coveralls": "^2.11.16",
"istanbul": "^0.4.5",
"mocha": "^3.2.0"
},
"dependencies": {
"is-plain-obj": "^1.1.0",
"pify": "^2.3.0"
}
}
'use strict'
/*
const path = require('path')
const isPlainObj = require('is-plain-obj')
const parseStructure = require('./parseStructure')
const writeStructure = require('./writeStructure')
/**
* Converts an object into a persistent or temporary directory structure.
* @public
* @param {?Array} structure - Array of objects containing information about a directory or file.
* @param {?Object} opts - Optional options.
* @returns {Promise} Returns the following properties if resolved: {Object}.
*/
module.exports = function() {
module.exports = function(structure = [], opts = {}) {
}
return new Promise((resolve, reject) => {
if (Array.isArray(structure)===false) {
throw new Error(`'structure' must be an array`)
}
if (isPlainObj(opts)===false && opts!=null) {
throw new Error(`'opts' must be an object, null or undefined`)
}
opts = Object.assign({
cwd: process.cwd()
}, opts)
// Support relative and absolute paths
opts.cwd = path.resolve(process.cwd(), opts.cwd)
parseStructure(structure, opts.cwd)
.then((parsedStructure) => writeStructure(parsedStructure))
.then(resolve, reject)
})
}
/**
* Constants for the structure.
* We don't use symbols for the constants as it should still be possible
* to copy, paste and use the JSON output of `tree`.
* @public
*/
module.exports.DIRECTORY = 'directory'
module.exports.FILE = 'file'
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