Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Kinto.js #50

Open
ghost opened this issue Feb 21, 2016 · 7 comments
Open

Support Kinto.js #50

ghost opened this issue Feb 21, 2016 · 7 comments
Labels
enhancement help wanted stale For marking issues as stale. Labeled issues will be closed soon if label is not removed.

Comments

@ghost
Copy link

ghost commented Feb 21, 2016

Any way to make this work with Kinto.JS Sync? It would be nice if I could attach the file offline in Kinto.JS, then have it extracted to S3 on the server during synch.

@leplatrem
Copy link
Contributor

Yep, indeed!

Would you be willing to work on it?

That would mean adding a notion of hooks in kinto.js so that file uploads is performed during synchronization of records with a attachment attribute. Same could be applied to downloads when records are fetched from server...

@ghost
Copy link
Author

ghost commented Feb 22, 2016

I would help, I just don't have the skills in Python to handle this. I work mostly in NodeJS these days, and have never programmed in Python. Python as a language is not difficult, but its all the other stuff you have to learn to go with it: pyramid, cliquet, etc. is just more than I can take on right now.

My applications don't require huge amounts of files (or large files). After mulling this over, my short term solution is going to be to:

  1. Store the file metadata as a record so I can retrieve just the meta about files without the files themselves.
  2. Base64 encode the file and raw file information (ext, size, etc) as a separate record and reference link it to the meta record. Yes, this means storing the file in Postgres, but I can live with this for a while. This should work with KintoJS and sync, and solve the basic problem of handling files if the user if offline. I can live with capping the file size of a single attachment to something reasonable for a REST API post.
  3. Write a Kinto plugin that adds a custom attachment endpoint that allows me to get a Base64 embedded record attachment as an HTTP file stream so it can be shared as a link, or rendered in href tags if the user is online.

If I can circle back on this once I get my MVP launched (and my Python skills improve), I would love to contribute in the future.

@Natim
Copy link
Member

Natim commented Feb 23, 2016

As far as I understand the part you are talking about is client side and not server side.

A Kinto.js hook is a little Javascript function:

That would mean adding a notion of hooks in kinto.js so that file uploads is performed during synchronization of records with an attachment attribute. Same could be applied to downloads when records are fetched from the server...

@ghost
Copy link
Author

ghost commented Feb 23, 2016

Oh, I am sorry, I misunderstood. I was assuming that the hooks you were describing would be server-side. A plugin/mixin model coupled with hooks for KintoJS would allow the client-side sync to be extended to support any server-side plugin that provides extensions to the REST API.

Let me dig into the code for KintoJS over the next couple of days and see what I can do.

@Natim
Copy link
Member

Natim commented Feb 23, 2016

@chrismbeckett Great, do not hesitate to ask your question on the IRC channel if you need any help or assistance.

@nasenfloete
Copy link

Any news on this? I would need offline file sync/upload, too!

@glasserc
Copy link
Contributor

I don't think there has been any change in this issue's status. Feel free to take a crack at it if you like. (Maybe this issue should be in the kinto.js repository?)

@alexcottner alexcottner added the stale For marking issues as stale. Labeled issues will be closed soon if label is not removed. label Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted stale For marking issues as stale. Labeled issues will be closed soon if label is not removed.
Projects
None yet
Development

No branches or pull requests

5 participants