Asynchronously reads a file from the application bundle and writes it to a destination on the device. Use with FuseJS/FileSystem to determine destination paths. This is useful for extracting html and associated content for local use with WebView via file:// protocol.

var Bundle = require("FuseJS/Bundle");
var FileSystem = require("FuseJS/FileSystem");
var Observable = require("FuseJS/Observable");
var urlForWebView = Observable();

Bundle.extract("assets/site/page.html", FileSystem.dataDirectory + "site/page.html").then(function(resultPath) {
    urlForWebView.value = "file://" + resultPath;
});

Location

Namespace
FuseJS
Package
FuseJS 2.9.1

Returns

Promise

A promise of the path the file was written to (echo)