$ gnpm install @wrote/read
@wrote/read is a package to read a file as a string or a Buffer.
yarn add -E @wrote/read
async read(path: string): stringasync readBuffer(path: string): BufferThe package is available by importing its default function read, and named function readBuffer:
import read, { readBuffer } from '@wrote/read'
async read(path: string,): stringRead the file as a string.
/* yarn example/ */
import read from '@wrote/read'
(async () => {
const res = await read('example/data.txt')
console.log(res)
})()
Hello World
async readBuffer(path: string,): BufferRead the file as a Buffer.
/* yarn example/ */
import { readBuffer } from '@wrote/read'
(async () => {
const res = await readBuffer('example/data.txt')
console.log(res)
})()
<Buffer 48 65 6c 6c 6f 20 57 6f 72 6c 64>
|
© Art Deco for Wrote 2019 |
|
|
Tech Nation Visa Sucks |
|---|
Copyright 2013 - present © cnpmjs.org | Home |