Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

@lucidcreative/disguise-asset

1.1.0 • Public • Published

disguise-asset

a simple library for converting a filepath to a disguise asset object.

type-safety is included out of the box.

Disguise asset object?

Disguise (aka d3) uses a set of content management rules to manage version replacements and other magic under the hood of their media server. This library attempts to recreate the logic they use to process a file based on it's file name and path. The resulting object looks like:

interface DisguiseAsset {
    stem: string
    extension: string
    version?: string
    proxyLevel?: number
    frameStart?: number
    originalFilename: string
}

you might notice that version is a string, when all other tags are numbers, and that's because date+letters is also a valid version tag. Versions are always sorted alphabetically.


Benchmark Summary:

Count Time
1 310112 μs
100 0.762929 ms
1000 6.511104 ms
1000000 171.870434 ms
  • μs = nanoseconds
  • test hardware:
    • Darwin x64
    • Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
    • 16.0 GB RAM
  • all tests done on randomized data, YMMV

brought to you by

Lucid

Install

npm i @lucidcreative/disguise-asset

DownloadsWeekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

3.24 kB

Total Files

2

Last publish

Collaborators

  • avatar
  • avatar