How to use schemes - 2 common examples

To help you get started, we’ve selected a few schemes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github assetgraph / assetgraph / lib / assets / Asset.js View on Github external
const pathModule = require('path');
const { promisify } = require('util');
const fs = require('fs');
const stat = promisify(fs.stat);
const readFile = promisify(fs.readFile);
const EventEmitter = require('events').EventEmitter;
const crypto = require('crypto');
const _ = require('lodash');
const extendDefined = require('../util/extendDefined');
const urlTools = require('urltools');
const urlModule = require('url');
const qs = require('qs');
const determineFileType = require('../util/determineFileType');
const AssetGraph = require('../AssetGraph');
const knownAndUnsupportedProtocols = require('schemes').allByName;
const urlEndsWithSlashRegExp = /\/(?:[?#].*)?$/;
const { URL } = require('url');

/**
 * Configuration object used to construct Assets in all places where an asset is automatically
 * constructed. For example in [AssetGraph.addAsset]{@link AssetGraph#addAsset}
 * or in the `to`-property in [Asset.addRelation]{@link Asset#addRelation}
 *
 *
 * @typedef {Object} AssetConfig
 *
 * @property {String} [type] The Assets type. Will be inferred if missing
 *
 * @property {Buffer} [rawSrc] `Buffer` object containing the raw source of the asset
 *
 * @property {String} [contentType] The Content-Type (MIME type) of the asset. For
github assetgraph / assetgraph / lib / index.js View on Github external
var util = require('util'),
    Promise = require('bluebird'),
    fs = Promise.promisifyAll(require('fs')),
    os = require('os'),
    constants = process.ENOENT ? process : require('constants'),
    childProcess = require('child_process'),
    _ = require('lodash'),
    EventEmitter = require('events').EventEmitter,
    pathModule = require('path'),
    Teepee = require('teepee'),
    resolveDataUrl = require('./util/resolveDataUrl'),
    extendDefined = require('./util/extendDefined'),
    urlTools = require('urltools'),
    normalizeUrl = require('normalizeurl'),
    TransformQueue = require('./TransformQueue'),
    knownAndUnsupportedProtocols = require('schemes').allByName,
    errors = require('./errors');

/**
 * new AssetGraph([options])
 * =========================
 *
 * Create a new AssetGraph instance.
 *
 * Options:
 *
 *  - `root` (optional) The root URL of the graph, either as a fully
 *           qualified `file:` or `http:` url or file system
 *           path. Defaults to the current directory,
 *           ie. `file:///`. The purpose of the root
 *           option is to allow resolution of root-relative urls
 *           (eg. `<a href="/foo.html">`) from `file:` locations.</a>

schemes

IANA Uniform Resource Identifier (URI) Schemes list, including crowd sourced unofficial ones

MIT
Latest version published 3 years ago

Package Health Score

50 / 100
Full package analysis

Popular schemes functions