pqina / react-filepond

🔌 A handy FilePond adapter component for React
https://pqina.nl/filepond
MIT License
1.85k stars 90 forks source link

Some questions #15

Closed martijnthe closed 6 years ago

martijnthe commented 6 years ago

Hi Rik,

FilePond looks really sweet!

I've a couple of questions:

Thanks.

martijnthe commented 6 years ago

Oh, one more question:

Re. sources: I somehow assumed dist/** would be minified, but it doesn't look like that's the case. So, ignore that question :)

rikschennink commented 6 years ago

Hi Martijn,

Thanks for your interest in FilePond!

Is it possible to make the request but a PUT and not do a multipart/form-data but put the file contents straight into the request body? (Just like curl http://server/api -T path/to/file would do.)

The default request uses POST you can configure this to be a PUT, I'm not sure what you mean with file contents straight into the request body? You could encode the file as a base64 string and send that? It's possible to customise the server configuration so you can communicate with your backend however you like. https://pqina.nl/filepond/docs/patterns/api/server/

In your blog post you're talking about sales. Is this a paid module? If so, where can I find pricing info?

It's no longer a paid product and has been available under MIT since april 2018. I might have to update that blog post :-)

I was looking for the sources (from which dist/** is derived) but couldn't find them. Are they available somewhere or is it "closed source"? I'd like to be able to review and also tweak the code if needed.

I'm going to put the original source files online as soon as possible, but as this will open up FilePond to pull requests I want to make sure I've got enough tests and other stuff in place to be able to handle those in a timely manner.

Last but not least; are you open for consulting work?

I am!

Are there TypeScript definition files available somewhere?

No, I haven't got a lot of experience with TypeScript so therefor there are none at the moment.

martijnthe commented 6 years ago

The default request uses POST you can configure this to be a PUT, I'm not sure what you mean with file contents straight into the request body?

Thanks. I noticed POST can be changed to PUT.

I reviewed your code and it looks like right now only sending a file as form data is supported (see https://github.com/pqina/filepond/blob/master/dist/filepond.js#L2962). Instead of doing xhr.send(formData), I'd need to have xhr.send(byteArrayWithContentsOfFile). The upload API that I need to work with expects the file's contents to be in the request body directly.

Are there TypeScript definition files available somewhere?

No, I haven't got a lot of experience with TypeScript so therefor there are none at the moment.

Ah, ok. Try it ;) I can recommend it.

rikschennink commented 6 years ago

To work around this you can set a custom processing function (see advanced section in server docs), this function will then receive the file, the metadata and the form field name, you can then do with the data as you please.

0livare commented 5 years ago

Are there TypeScript definition files available somewhere?

I created typescript definitions for react-filepond here.