News for hackers. Stuff that matters.
Re:Instant.io – Streaming file transfer over WebTorrent by amlib on Sunday September 18, 2016 @04:22PM (#12527048)
Tried to stream a 20GB mkv and it ate all my memory until the oom killer took over =(
Re:Instant.io – Streaming file transfer over WebTorrent by nashashmi on Sunday September 18, 2016 @04:35PM (#12527104)
Yup, It uses the browser's memory to transfer files.

Until browser apps can be given permission to access the file system, this will be yhe case.

Re:Instant.io – Streaming file transfer over WebTorrent by EE84M3i on Sunday September 18, 2016 @05:00PM (#12527197)
We have this today, it's just that this site doesn't support it. Only place I've seen this used (other than thumbnailing images that are drag and dropped on imgur and whatnot) is on Mega.

Spec: https://www.w3.org/TR/FileAPI/

MDN: https://developer.mozilla.org/en-US/docs/Web/API/File_and_Di...

Re:Instant.io – Streaming file transfer over WebTorrent by eriknstr on Sunday September 18, 2016 @06:21PM (#12527507)
The MDN article mentions something which I have a question about;

>The API doesn't give you access to the local file system, nor is the sandbox really a section of the file system. Instead, it is a virtualized file system that looks like a full-fledged file system to the web app. It does not necessarily have a relationship to the local file system outside the browser.

>What this means is that a web app and a desktop app cannot share the same file at the same time. The API does not let your web app reach outside the browser to files that desktop apps can also work on. You can, however, export a file from a web app to a desktop app. For example, you can use the File API, create a blob, redirect an iframe to the blob, and invoke the download manager.

Is it possible to "see" from JavaScript whether or not the download manager has downloaded the file completely, so that the file can be removed from FileAPI storage?

Re:Instant.io – Streaming file transfer over WebTorrent by feross on Sunday September 18, 2016 @06:36PM (#12527564)
I think the spec you're looking for is the FileSystem API (https://developer.mozilla.org/en-US/docs/Web/API/File_and_Di...), not the File API.

Unfortunately, this is a non-standard API implemented only by Chrome. You have to use other APIs like IndexedDB and WebSQL (also deprecated and non-standard) to get a working solution in all browsers.

This deficiency is really holding back the web.

Re:Instant.io – Streaming file transfer over WebTorrent by erbbysam on Sunday September 18, 2016 @06:50PM (#12527607)
Yup, this works - https://github.com/erbbysam/webRTCCopy/blob/master/client/js... (not the cleanest code)

You can then use idb.filesystem.js to add api support for firefox etc. Search the file above for "is_chrome" for a few idb.filesystem.js-specific quirks.

Looking at that page, it looks like firefox will ship with support in version 50?

Re:Instant.io – Streaming file transfer over WebTorrent by szimek on Monday September 19, 2016 @03:30AM (#12529599)
I'm using idb.filesystem.js in https://www.sharedrop.io, so that only very small part of the transferred file is stored in memory, but then without asking users for permission (i.e. using non-persistent storage) you "only" get ~4GB (not sure exactly, I tested it with files up to 1.5GB).
Re:Instant.io – Streaming file transfer over WebTorrent by donpark on Sunday September 18, 2016 @06:46PM (#12527592)
Have you looked into using IndexedDB? It's pretty widely supported [1] and far more performant than Files API last time I used it intensively (few years ago).

[1]: http://caniuse.com/#feat=indexeddb