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

io-extra

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

io-extra - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

1

io/directory.js

@@ -24,2 +24,3 @@ const fs = require('fs-promise');

remove,
delete: remove,
};

@@ -19,2 +19,14 @@ const fs = require('fs-promise');

function read(file, options = {}) {
const opts = Object.assign({}, options);
if (!opts.encoding) {
opts.encoding = 'utf8';
}
return fs.readFile(file, opts);
}
function write(file, data, options) {
return fs.outputFile(file, data, options);
}
module.exports = {

@@ -25,2 +37,5 @@ path,

remove,
delete: remove,
read,
write,
};

2

package.json
{
"name": "io-extra",
"version": "0.0.3",
"version": "0.0.4",
"description": "",

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

@@ -38,2 +38,4 @@ # io-extra

- [remove](#remove-file)
- [read](#read-file)
- [write](#write-file)

@@ -91,2 +93,4 @@ ### resolve fullpath

Alias: `delete()`
Example:

@@ -100,6 +104,45 @@

### read file
**read(file, [encoding])**
Reads the entire contents of a file.
Promise contains the text of the file.
encoding = (optional string) specifies the type of encoding to read the file. Possible encodings are 'ascii', 'utf8', and 'base64'. If no encoding is provided, the default is utf8.
Example:
```js
const io = require('io-extra');
io.file.read('/tmp/myfile').then((text) => console.log(text));
```
### write file
**write(file, data, [encoding])**
Writes data to a file, replacing the file if it already exists.
If the parent directory does not exist, it's created.
Empty promise is returned.
file = (string) filepath of the file to write to.
data = (string or buffer) the data you want to write to the file.
encoding = (optional string) the encoding of the data. Possible encodings are 'ascii', 'utf8', and 'base64'. If no encoding provided, then 'utf8' is assumed.
Example:
```js
const io = require('io-extra');
io.file.write('/tmp/myfile', 'io-extra is easy!').then(() => console.log('file written.'));
```
Directory
-------
- [path](#resolve-fullpath)
- [path](#resolve-directory-fullpath)
- [exists](#directory-exists)

@@ -109,3 +152,3 @@ - [create](#create-directory)

### resolve fullpath
### resolve directory fullpath
**path(directory)**

@@ -161,2 +204,4 @@

Alias: `delete()`
Example:

@@ -163,0 +208,0 @@

Sorry, the diff of this file is not supported yet

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