A Javascript library for parsing frame ranges and file sequences commonly used in VFX and Animation applications.
Based on the python "fileseq" library: https://github.com/justinfx/fileseq
npm i fileseq
# OR
yarn add fileseq
const fileseq = require("fileseq");
Support for:
- Standard: 1-10
- Comma Delimited: 1-10,10-20
- Chunked: 1-100x5
- Filled: 1-100y5
- Staggered: 1-100:3 (1-100x3, 1-100x2, 1-100)
- Negative frame numbers: -10-100
- Padding: #=4 padded, @=single pad
- Printf Syntax Padding: %04d=4 padded, %01d=1 padded
- Houdini Syntax Padding: $F4=4 padding, $F=1 padded
A FrameSet wraps a sequence of frames in a list list container.
var fs = new fileseq.FrameSet("1-5");
fs.frames.forEach(frame => {
console.log(frame);
});
var fs = fileseq.FrameSet("1-100:8");
fs.frames[0]; // First frame.
// 1
fs.frames[fs.frames.length-1]; // Last frame.
// 98
var fs = fileseq.FrameSet("1-100:8");
fs.start(); // First frame.
// 1
fs.end(); // Last frame.
// 98
var seq = new fileseq.FileSequence("/foo/bar.1-10#.exr");
var seq = new fileseq.FileSequence("/foo/bar.1-10#.exr");
seq.format('{dirname}{basename}{padding}{extension}');
// "/foo/bar.#.exr"
var seq = new fileseq.FileSequence("/foo/bar.1-10#.exr");
`${seq.dirname}${seq.basename}%0${seq.end().toString().length}d${seq.extension}`;
// "/foo/bar.%02d.exr"
var seqs = fileseq.findSequencesOnDisk("/show/shot/renders/bty_foo/v1");