Skip to content

createFileChunked failing with low size file #221

@hxn-dev

Description

@hxn-dev

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions