Registry / devops / jsjianyingdraft

jsjianyingdraft

JSON →
library1.0.0jsnpmunverified

jsJianYingDraft v1.0.0 is a TypeScript port of pyJianYingDraft for programmatically generating JianYing (CapCut) draft files. It provides draft folder lifecycle, track/segment editing, SRT import, effects, keyframes, masks, transitions, and a Windows automation controller. The package ships first-class TypeScript types, dual ESM/CJS builds, Python-compatible snake_case aliases for migration, and metadata presets. It requires Node >= 18 and is maintained by the pyJianYingDraft community with active development.

npm install jsjianyingdraft
INSTALL
IMPORT
SIG · JSJIANYINGDRAFT
J
jsjianyingdraft
devopsjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DraftFolder
import { DraftFolder } from 'jsjianyingdraft'
import DraftFolder from 'jsjianyingdraft'
Default import is not available; use named import.
ScriptFile
import { ScriptFile } from 'jsjianyingdraft'
const ScriptFile = require('jsjianyingdraft').ScriptFile
If using CommonJS, use require but note the package is ESM-first. Named export.
TrackType
import { TrackType } from 'jsjianyingdraft'
import { Track_type } from 'jsjianyingdraft'
Track_type is a compatibility alias; prefer TrackType. Both work.
VideoSegment
import { VideoSegment } from 'jsjianyingdraft'
import { Video_segment } from 'jsjianyingdraft'
Video_segment is a deprecated alias; use VideoSegment.
trange
import { trange } from 'jsjianyingdraft'
import { Timerange } from 'jsjianyingdraft'
trange is a helper for creating timeranges; Timerange is a class, not equivalent.

Creates a draft with video/audio track, adds segments, imports subtitle, and saves.

import { AudioMaterial, AudioSegment, DraftFolder, TrackType, VideoMaterial, VideoSegment, trange } from 'jsjianyingdraft'; const folder = new DraftFolder('D:/JianYingDrafts'); const script = folder.createDraft('demo', 1920, 1080, { allowReplace: true }); script.addTrack(TrackType.video).addTrack(TrackType.audio).addTrack(TrackType.text, 'subtitle'); const video = new VideoMaterial('D:/assets/video.mp4', { duration: 8000000, width: 1920, height: 1080 }); const audio = new AudioMaterial('D:/assets/audio.mp3', { duration: 8000000 }); script.addSegment(new VideoSegment(video, trange('0s', '8s'))) .addSegment(new AudioSegment(audio, trange('0s', '8s'))) .importSrt('D:/assets/subtitle.srt', 'subtitle') .save();
Debug
Known issues
deprecatedsnake_case aliases (e.g., Draft_folder, Video_segment) are deprecated and will be removed in future versions.
fix
Use PascalCase equivalents (e.g., DraftFolder, VideoSegment).
affects: >=1.0.0
breakingConstructor signatures for VideoMaterial and AudioMaterial changed: second parameter is now an options object, not direct duration.
fix
Use new VideoMaterial(path, { duration: ..., width: ..., height: ... }).
affects: >=1.0.0
gotchaTimerange constructor expects microseconds (not milliseconds). A common mistake is passing milliseconds.
fix
Use trange helper (e.g., trange('0s', '8s')) or multiply seconds by 1_000_000.
affects: >=1.0.0
deprecatedmaterial_options field is deprecated in favor of materialOptions.
fix
Use materialOptions in segment constructors.
affects: >=1.0.0
gotchaimportSrt targetTrack parameter must match a previously added text track name (e.g., 'subtitle'), otherwise it throws.
fix
Ensure a text track with matching name exists before calling importSrt.
affects: >=1.0.0
deprecatedPython-style enum from_name method is deprecated; use direct enum values instead.
fix
Replace TrackType.from_name('video') with TrackType.video.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'jsjianyingdraft'
Package not installed or import path incorrect.
fix
Run 'npm install jsjianyingdraft' (ensure Node >= 18).
TypeError: Draft_folder is not a constructor
Using deprecated snake_case alias without correct import.
fix
Use 'import { DraftFolder } from 'jsjianyingdraft'' (PascalCase).
TypeError: Timerange is not a constructor
Incorrect import or missing import of Timerange class.
fix
Import Timerange directly: 'import { Timerange } from 'jsjianyingdraft''.
Error: Draft folder not found: D:/JianYingDrafts
The specified draft folder path does not exist or is invalid.
fix
Verify the folder path and ensure JianYing draft storage directory is correct.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
jsjianyingdraft — npm install jsjianyingdraft · libregistry