nodejs create stream
const { Readable } = require("stream")
const readable = Readable.from(["input string"])
readable.on("data", (chunk) => {
console.log(chunk) // will be called once with `"input string"`
})
nodejs create stream
const { Readable } = require("stream")
const readable = Readable.from(["input string"])
readable.on("data", (chunk) => {
console.log(chunk) // will be called once with `"input string"`
})
nodejs stream
const stream = require('stream')
const fs = require('fs')
const html = "<h1> Hello Wordl </h1>
// read file from string and write file
const stream = new Stream()
stream.pipe = function (dest) {
dest.write(html)
return dest
}
stream.pipe(createWriteStream(resolve(process.cwd(), 'index.html'), 'utf8'))
// read file from directory and write file
fs.createReadStream('testing.html')
.pipe(createWriteStream(resolve(process.cwd(), 'index.html'), 'utf8'))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us