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

smart-fs

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smart-fs - npm Package Compare versions

Comparing version 1.1.4 to 1.2.0

lib/logic/guess-file.js

3

lib/index.js

@@ -0,3 +1,4 @@

module.exports.guessFile = require('./logic/guess-file');
module.exports.smartRead = require('./logic/smart-read');
module.exports.smartWrite = require('./logic/smart-write');
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwic21hcnRSZWFkIiwicmVxdWlyZSIsInNtYXJ0V3JpdGUiXSwibWFwcGluZ3MiOiJBQUNBQSxNQUFNLENBQUNDLE9BQVAsQ0FBZUMsU0FBZixHQUEyQkMsT0FBTyxDQUFDLG9CQUFELENBQWxDO0FBQ0FILE1BQU0sQ0FBQ0MsT0FBUCxDQUFlRyxVQUFmLEdBQTRCRCxPQUFPLENBQUMscUJBQUQsQ0FBbkMiLCJzb3VyY2VzQ29udGVudCI6WyJcbm1vZHVsZS5leHBvcnRzLnNtYXJ0UmVhZCA9IHJlcXVpcmUoJy4vbG9naWMvc21hcnQtcmVhZCcpO1xubW9kdWxlLmV4cG9ydHMuc21hcnRXcml0ZSA9IHJlcXVpcmUoJy4vbG9naWMvc21hcnQtd3JpdGUnKTtcbiJdfQ==
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwiZ3Vlc3NGaWxlIiwicmVxdWlyZSIsInNtYXJ0UmVhZCIsInNtYXJ0V3JpdGUiXSwibWFwcGluZ3MiOiJBQUNBQSxNQUFNLENBQUNDLE9BQVAsQ0FBZUMsU0FBZixHQUEyQkMsT0FBTyxDQUFDLG9CQUFELENBQWxDO0FBRUFILE1BQU0sQ0FBQ0MsT0FBUCxDQUFlRyxTQUFmLEdBQTJCRCxPQUFPLENBQUMsb0JBQUQsQ0FBbEM7QUFDQUgsTUFBTSxDQUFDQyxPQUFQLENBQWVJLFVBQWYsR0FBNEJGLE9BQU8sQ0FBQyxxQkFBRCxDQUFuQyIsInNvdXJjZXNDb250ZW50IjpbIlxubW9kdWxlLmV4cG9ydHMuZ3Vlc3NGaWxlID0gcmVxdWlyZSgnLi9sb2dpYy9ndWVzcy1maWxlJyk7XG5cbm1vZHVsZS5leHBvcnRzLnNtYXJ0UmVhZCA9IHJlcXVpcmUoJy4vbG9naWMvc21hcnQtcmVhZCcpO1xubW9kdWxlLmV4cG9ydHMuc21hcnRXcml0ZSA9IHJlcXVpcmUoJy4vbG9naWMvc21hcnQtd3JpdGUnKTtcbiJdfQ==
{
"name": "smart-fs",
"version": "1.1.4",
"version": "1.2.0",
"description": "Abstraction Layer for File Management.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -20,4 +20,11 @@ # smart-fs

To ignore file extension and force treat the file as a certain type, you can pass the option `treatAs` as e.g. `json`.
### guessFile(filepath)
Extends and returns filepath with the file extension as appropriate. Returns `null` if no good match was found.
A few notes:
- Only extends extensions, not partial file names
- Will prefer to match the exact file
- Will return `null` when multiple possible extensions are found
### smartRead(filepath, options = { treatAs = null })

@@ -36,2 +43,4 @@

To ignore file extension and force treat the file as a certain type, you can pass the option `treatAs` as e.g. `json`.
### smartWrite(filepath. content, options = { treatAs = null, mergeStrategy = (existing, changeset) => changeset })

@@ -52,2 +61,4 @@

To ignore file extension and force treat the file as a certain type, you can pass the option `treatAs` as e.g. `json`.
The `mergeStrategy` option can be used to customize how the new content is merged if the target file already exists.

@@ -54,0 +65,0 @@ By default the file is simply overwritten.

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