Load and store project and asset files for Scratch 3.0
Last updated 3 years ago by scratch .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install scratch-storage 
SYNC missed versions from official npm registry.


Scratch Storage is a library for loading and storing project and asset files for Scratch 3.0

Build Status Coverage Status Greenkeeper badge


This requires you to have Node.js installed.

In your own Node.js environment/application:

npm install

If you want to edit/play yourself (requires Git):

git clone
cd scratch-storage
npm install

Using scratch-storage


<script src="scratch-storage/dist/web/scratch-storage.js"></script>
    var storage = new Scratch.Storage();
    // continue to "Storage API Quick Start" section below

From Node.js / Webpack

var storage = require('scratch-storage');
// continue to "Storage API Quick Start" section below

Storage API Quick Start

Once you have an instance of scratch-storage, add some web sources. For each source you'll need to provide a function to generate a URL for a supported type of asset:

 * @param {Asset} asset - calculate a URL for this asset.
 * @returns {string} a URL to download a project asset (PNG, WAV, etc.)
var getAssetUrl = function (asset) {
    var assetUrlParts = [
    return assetUrlParts.join('');

Then, let the storage module know about your source:

    [AssetType.ImageVector, AssetType.ImageBitmap, AssetType.Sound],

If you're using ES6 you may be able to simplify all of the above quite a bit:

    [AssetType.ImageVector, AssetType.ImageBitmap, AssetType.Sound],
    asset => `${asset.assetId}.${asset.dataFormat}/get/`);

Once the storage module is aware of the sources you need, you can start loading assets:

storage.load(AssetType.Sound, soundId).then(function (soundAsset) {
    // `soundAsset` is an `Asset` object. File contents are stored in ``.

If you'd like to use scratch-storage with scratch-vm you must "attach" the storage module to the VM:



To run all tests:

npm test

To show test coverage:

npm run coverage


This project uses semantic release to ensure version bumps follow semver so that projects using the config don't break unexpectedly.

In order to automatically determine the type of version bump necessary, semantic release expects commit messages to be formatted following conventional-changelog.

<type>(<scope>): <subject>

subject and body are your familiar commit subject and body. footer is where you would include BREAKING CHANGE and ISSUES FIXED sections if applicable.

type is one of:

  • fix: A bug fix Causes a patch release (0.0.x)
  • feat: A new feature Causes a minor release (0.x.0)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance May or may not cause a minor release. It's not clear.
  • test: Adding missing tests or correcting existing tests
  • ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit

Use the commitizen CLI to make commits formatted in this way:

npm install -g commitizen
npm install

Now you're ready to make commits using git cz.

Breaking changes

If you're committing a change that makes an API change, or will otherwise require changes to existing code, ensure your commit specifies a breaking change. In your commit body, prefix the changes with "BREAKING CHANGE: " This will cause a major version bump so downstream projects must choose to upgrade and will not break the build unexpectedly.


We provide Scratch free of charge, and want to keep it that way! Please consider making a donation to support our continued engineering, design, community, and resource development efforts. Donations of any size are appreciated. Thank you!

Current Tags

  • 1.3.3                                ...           latest (5 months ago)

27 Versions

  • 1.3.3                                ...           5 months ago
  • 1.3.2                                ...           a year ago
  • 1.3.1                                ...           2 years ago
  • 1.3.0                                ...           2 years ago
  • 1.2.2                                ...           2 years ago
  • 1.2.1                                ...           2 years ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 0.5.1                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.4.1                                ...           2 years ago
  • 0.4.0                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.2.1                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.1-prerelease.1493666172                                ...           3 years ago
  • 0.0.1-prerelease.1492804959                                ...           4 years ago
  • 0.0.1-prerelease.1492620984                                ...           4 years ago
  • 0.0.1-prerelease.1490024951                                ...           4 years ago
  • 0.0.1-prerelease.1489787346                                ...           4 years ago
Maintainers (1)
Today 4
This Week 90
This Month 535
Last Day 28
Last Week 239
Last Month 1,394
Dependencies (0)
Dev Dependencies (23)

Copyright 2014 - 2016 © |