Skip to Content
๐ŸŽฒ Welcome to RandBox - Powerful JavaScript Random Data Generation Library! Learn More

File with content

Generates a file with random name, extention and data

// Usage randBox.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

randBox.fileWithContent({fileSize: 1024})

Random format

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