Socket
Book a DemoInstallSign in
Socket

broccoli-image-meta

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-image-meta

Get meta data from a given image tree

2.0.3
latest
Source
npmnpm
Version published
Weekly downloads
13
30%
Maintainers
1
Weekly downloads
 
Created
Source

broccoli-image-meta

Build Status GitHub version NPM version Dependency Status codecov Greenkeeper badge

Information

NPM

Process a source of images and generate a JSON with image metadata.

Why? For example, to create a component able to load a thumbnail or a colored box while the real image still loading.

Installation & usage

npm install --save broccoli-image-meta

// Raw
const ImageMeta = require('broccoli-image-meta');
const { color, dimensions } = ImageMeta;

const myTree = new Funnel('assets/images');
const thumbnailTree = new ImageMeta(myTree, {
  outputFile: 'meta.json',
  globs: [
    '**/*.{jpg,jpeg,gif,png}'
  ],
  filters: [color, dimensions]
});
// Ember addon style
const BroccoliImageMeta = require('broccoli-image-meta');

module.exports = {
  // ...

  treeForPublic() {
    return new BroccoliImageMeta('assets/images', { /* options */ });
  }
};

Options

OptionTypeDefaultsDescription
outputFileStringmeta.jsonOutput file name
extensionsArray['jpg', 'jpeg', 'gif', 'png']Files to be processed
filtersArray[]Image preprocessors
persistBooleantrueUse disk cache
formatOutputFunction(meta) => JSON.stringify(meta)Content to write inside the output file

Filters

The filter is just a Function that must return an Object (promise compatible) and receiver an Entry (an object with basePath and relativePath). The object will be merged with the rest of the data created by other filters.

Examples in lib/filters/.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Keywords

brocoli

FAQs

Package last updated on 28 Jun 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.