You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

633 B

File with content

Generates a file with random name, extention and data

// Usage
chance.fileWithContent({
  fileName: "AwesomeFile",
  fileExtension: "gif",
  fileSize: 1024})

Returns an object with fileData as a Buffer and file name as a String

// Returns
{
  fileData: <Buffer 00 00 00... 1998 more bytes>,
  fileName: 'zo.gif'
}

Random name and format

chance.fileWithContent({fileSize: 1024})

Random format

chance.fileWithContent({
  fileName: "AwesomeFile",
  fileSize: 2048})
  • Takes the optional fileName and fileExtension, otherwise generates from file()
  • 0 Size files are ok