Skip to content

URL loader and type converter. URL -> String/JSON/Blob/ArrayBuffer, Blob/TypedArray/ArrayBuffer -> ArrayBuffer

License

Notifications You must be signed in to change notification settings

uupaa/FileLoader.js

Repository files navigation

FileLoader.js Build Status

npm

URL loader and type converter.

This module made of WebModule.

Documentation

Browser, NW.js and Electron

<script src="<module-dir>/lib/WebModule.js"></script>
<script src="<module-dir>/lib/FileLoader.js"></script>
<script>

// load resource
FileLoader.loadString(URLString, function(string) { ... });
FileLoader.loadJSON(URLString, function(json) { ... });
FileLoader.loadBlob(URLString, function(blob) { ... });
FileLoader.loadArrayBuffer(URLString, function(arrayBuffer) { ... });

// convert BlobURLString|URLString|Blob|File|TypedArray|ArrayBuffer to ArrayBuffer
FileLoader.toArrayBuffer(source, function(arrayBuffer) { ... });

</script>

WebWorkers

importScripts("<module-dir>lib/WebModule.js");
importScripts("<module-dir>lib/FileLoader.js");

Node.js

require("<module-dir>lib/WebModule.js");
require("<module-dir>lib/FileLoader.js");

About

URL loader and type converter. URL -> String/JSON/Blob/ArrayBuffer, Blob/TypedArray/ArrayBuffer -> ArrayBuffer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published