Skip to content

4front/s3-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

4front-s3-storage

Build Status Test Coverage

S3 based storage for the 4front web platform. Used to store deployed assets such as JavaScripts, stylesheets, html files, images, and more.

Although static assets can be served via the 4front node.js platform, it is more efficient to use S3 as a web host directly with CloudFront (or another CDN) sitting in front. See the AWS docs on how to configure an S3 bucket for static hosting. The htmlprep package dynamically rewrites relative asset paths in HTML files to the appropriate absolute path.

For a local installation of the 4front platform, the s3rver provides a mock implementation of S3 that utilizes your local filesystem.

Usage

var s3Storage = require('4front-s3-storage')({
	region: 'us-west-2',
	bucket: '4front-deployments'
});

You can pass in any valid option accepted by the AWS.config object including region, accessKeyId, secretAccessKey, etc.

API

// Deploy an individual file
s3Deployments.deployFile(appId, versionId, fileInfo, callback);

// Returns a readable stream
s3Deployments.readFileStream(appId, versionId, filePath);

// Delete files based on a prefix
s3Deployments.deleteFiles(prefix, callback);

// List all the files for a version
s3Deployments.listFiles(appId, versionId, callback);

// Check if file exists
s3Deployments.fileExists(filePath, callback);

See the unit tests for example calls of all these functions.

Running Tests

npm test

License

Licensed under the Apache License, Version 2.0. See (http://www.apache.org/licenses/LICENSE-2.0).

About

S3 based storage for 4front

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published