Using createFileChunked to upload a file under ~200kb give no errors but the file wont be correctly uploaded
try {
const folder = 'X'
const fileName = 'X'
const filePath = path.resolve(__dirname, folder, fileName)
const { size } = fs.statSync(filePath)
const stream = fs.createReadStream(filePath, { highWaterMark: 1024 * 125 })
await sp.createFileChunked({
path: 'XXX',
fileName,
stream,
fileSize: size,
chunkSize: 1024 * 125
})
} catch (error) {
console.error(error)
}
I'm using createFileChunked because I was looping trough all my CSV files and someones are greater than 500mb.
A quick workaround would be to check the file size and use only createFileChunked when the file is greater than the sharepoint size limits