Stun3R/strapi-sdk-js

Upload & Bulk Upload

Closed this issue · 5 comments

Feature request

Summary

I've created new feature upload & multiple file upload, can i contribute ?

Why is it needed?

It's helpful when we have upload feature

Suggested solution(s)

Related issue(s)/PR(s)

Hi @aldycavalera
Can you provide more informations about what you plan to do like code snippet, examples? ☺️

Okay, so strapi had upload feature, it seems like strapi-sdk-js doesn't have the features that allow user to upload their files yet. So i made a simple function to achieve that, i created these two :

upload(file, callback)

to upload single file

const file = new File(['foo'], 'bar')
await strapi.upload(file, (res) => {
    console.log(res)
})

bulkUpload(files, callback)

Upload multiple files at once

const files = [new File(['foos'], 'bars'), new File(['bars'], 'foos')]
await strapi.bulkUpload(files, (res) => {
    console.log(res)
})

it would be awesome if you allow me to create a pr, and submit a review :)

huy-lv commented

hey, what is the current status of this issue

Stun3R commented

For now there is no plan to add an upload method set but will look into it to check if it's relatively needed

huy-lv commented

@Stun3R can I make a PR for this