file-access
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

file-access

version Codecov release node.js languages

Easily fetch local or remote file, and return buffer data.

Not suitable for accessing large files

轻松获取本地或远程文件, 并返回buffer数据。(不适用于大文件)

Usage

const {
  accessFile,
  accessLocalFileSync
} = require('file-access');


accessFile('/path/to/local.txt', (err, data) => {
  // ...
})

accessFile('https://example.com/file.zip').then((data) => {
  // ...
  console.log('file size : ', data.byteLength)
  conosle.log('content-type :', data.contentType)
})

const buffer = accessLocalFileSync('/path/to/local.txt')

Package Sidebar

Install

npm i file-access

Weekly Downloads

0

Version

1.1.2

License

MIT

Unpacked Size

10.5 kB

Total Files

6

Last publish

Collaborators

  • mengqing723