Skip to content

Instantly share code, notes, and snippets.

@jrainlau
Created October 12, 2016 03:00
Show Gist options
  • Save jrainlau/cf7387e283a4f8b5561e0f5bd2c51273 to your computer and use it in GitHub Desktop.
Save jrainlau/cf7387e283a4f8b5561e0f5bd2c51273 to your computer and use it in GitHub Desktop.
批量复制
const fs = require('fs')
let pic = fs.readFileSync(`${__dirname}/dog.jpg`)
let readStream = fs.createReadStream(`${__dirname}/dog.jpg`)
for (let i = 0; i < 400; i++) {
readStream.pipe(fs.createWriteStream(`${__dirname}/输出目录/dog-${i}.jpg`))
}
console.log('done')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment