Skip to content
This repository has been archived by the owner on May 12, 2023. It is now read-only.

feat: custom file size limit and mime types at bucket level #58

Merged
merged 4 commits into from
Apr 12, 2023

Conversation

dshukertjr
Copy link
Member

What kind of change does this PR introduce?

Feature

Dart implementation of this supabase/storage-js#151

What is the new behavior?

It is now possible to specify, file_size_limit and allowed_mime_types when creating a bucket.
These limits will be imposed during the upload of an asset, allowing you to validate server side the values

Example:

// Create Bucket with file size limit 20mb
await storage.createBucket(
  newBucketName,
  const BucketOptions(
    public: true,
    fileSizeLimit: 20000000, // 20 mb
    allowedMimeTypes: ['image/jpeg'],
  ),
);

// load the file
final bigFile = ... // 1GB

// Upload
await storage.from(bucketName).upload(uploadPath, bigFile); // throws an error

@dshukertjr dshukertjr requested review from bdlukaa and Vinzent03 and removed request for bdlukaa April 12, 2023 09:07
@dshukertjr dshukertjr merged commit e308573 into main Apr 12, 2023
@dshukertjr dshukertjr deleted the feat/bucket-enhancement branch April 12, 2023 09:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants