Node.js - bucket.file.write()

Write a file to a bucket.

import { bucket } from '@nitric/sdk'

const assets = bucket('assets').allow('write')

const logo = assets.file('images/logo.png')

await logo.write(someImageData)

Parameters

  • Name
    data
    Required
    Required
    Type
    Uint8Array
    Description

    The data to write to the file.

Examples

Write a file

import { bucket } from '@nitric/sdk'

const assets = bucket('assets').allow('write')

const txt = assets.file('my-text-file.txt')
const buffer = Buffer.from('My Test File...')

await txt.write(buffer)