New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

assetment

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assetment

Assesses & extracts references to all the assets in your markup.

latest
Source
npmnpm
Version
0.3.1
Version published
Maintainers
1
Created
Source

assetment Build Status

Assesses & extracts references to all the assets in your markup.

Getting Started

npm install --save assetment

Usage

Pass assetment() a String of markup and an Object with the types of assets you would like to extract.

var assetment = require( "assetment" );
var markup = fs.readFile( "filename.html", "utf8" );
var filters = {
  images: true,
  javascripts: true,
  stylesheets: true
}


console.log( assetment( markup, filters ) );
/*
{
  images: [
    {
      resource: "image.png",
      attributes: { alt: "image", src: "image.png" }
    {
  ],
  javascripts: [
    {
      resource: "script.js",
      attributes: { type: "text/javascript", src: "script.js" }
    {
  ],
  stylesheets: [
    {
      resource: "style.css",
      attributes: { type: "text/css" , src: "style.css" }
    {
  ]
}
*/

API

assetment( markup, filters )

NameTypeArgumentDefaultDescription
markupstring<required>nullMarkup that you would like to extract the assets from.
filtersObject<required>nullObject that contains the types of assets you want to extract.
filters.imagesboolean<optional>falseExtract references to image files.
filters.javascriptsboolean<optional>falseExtract references to JavaScript files.
filters.stylesheetsboolean<optional>falseExtract references to stylesheet files.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.

License

Copyright (c) 2014 Jason Bellamy
Licensed under the MIT license.

Keywords

scrape

FAQs

Package last updated on 15 Mar 2014

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