
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
stratosphere
Advanced tools
Shrink wrap your dynamically generated assets. If you use tools like browserify to build your front-end code, you should consider saving the output to disk as part of your deploy process. This allows you to freeze an entire version of your app inside a container like Docker and test the release with confidence that things will not change in the future because the app was built with a different browserify version, or in a different environment.
// See Full Usage for all options
var instance = stratosphere(app, {assets: 'assets.json', root: 'cachedir'})
// Save assets to disk
instance.writeAssets(function () {
// Intercept requests for assets and serve from memory
instance.intercept().listen(8080)
})
var stratosphere = require('stratosphere')
// app is your http server.
var app = require('./your-app')
// Stratosphere options
var opts = {
// The assets you want to freeze are declared here.
// Required.
assets: './assets.json'
// The directory where you want to save the frozen assets to.
// Required.
, root: './assets'
// This is the route that you want to serve your manifest file on.
// Optional.
, route: 'manifest.json'
// When true, will disable Stratosphere, passing all requests
// straight to the app.
// Default: false.
, disable: false
// When true, will not empty the root asset directory on initialization.
// Default: false.
, noFlush: false
// Used to override manifest defaults. Default: {}.
, manifestOpts: {version: '1.0.0'}
}
// Stratosphere wraps your server using the rules in your manifest
// The callback is optional, and will be called if preload == true
// when preloading is complete
var instance = stratosphere(app, opts, function (err, assets) {
if(err)
console.error(err)
else
console.log('Preloading complete')
// assets is an object containing the preloaded assets
// note the leading slashes -- routes are normalized
// {'/route/1': 'asset data', '/route/2': 'dat'} etc...
})
// The `intercept` method will modify its `request` listeners to respond
// with cached data from the filesystem when possible, and return the server
instance.intercept().listen(8080)
/*
* If you want to write your assets to disk
*
* Gotcha: Calling this method on a server that is not listening on any
* ports will bind it to an ephremeral one. If you plan to use the server
* to handle actual requests you'll want to bind it to a port before
* calling this method.
*/
instance.writeAssets(function (err) {
// Handle the error
})
/*
* If you want to load all assets into memory
*
* Gotcha: Calling this method on a server that is not listening on any
* ports will bind it to an ephremeral one. You almost definitely want
* to call this only after binding your server to a port of your choice.
*/
instance.preload(function (err, assets, manifest) {
// Handle the error
})
// To flush the asset cache that is in memory (not the one on disk!)
instance.flush()
You can either use a JSON file, or a .js file that exports an array.
// If you serve lots of static assets like fonts, it might be helpful
// to glob for them
var fonts = require('glob').sync('./fonts/*')
// Should export an array of strings that represent routes on the server
// Routes without a leading slash will be have one added to them
module.exports = [
// shorthand syntax is just a string
'app/bundle.js'
// shorthand is expanded into the equivalent verbose syntax
// which is useful when fine control over the manifest is desired
, {
source: '/app/bundle.js'
, destination: 'app/bundle.js'
, key: 'app/bundle.js'
}
].concat(fonts)
The manifest that Stratosphere serves is Phonegap Air compatible.
FAQs
Shrink wrap your dynamically generated assets
We found that stratosphere demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.