kt-io
v1.1.0
Published
File importing operations with extendscript
Readme

KT-IO
A TypeScript library for file I/O operations in Adobe ExtendScript environments (e.g., After Effects, Photoshop, Illustrator).
Overview
KT-IO provides a comprehensive set of static methods for common file system operations in ExtendScript. It abstracts away low-level File and Folder objects, offering a simple, consistent API for reading/writing files, JSON serialization, directory management, and path resolution with cross-platform compatibility.
All this environment is based on Bolt CEP building code, so you can use it with Bolt itself. Also it uses Types for Adobe for Adobe Apps TypeScript support.
Installation
To install KT-IO, use the following command:
npm install kt-ioBasic Usage
Here are some examples of how to use KT-IO:
// src/index.ts
import { IO } from "kt-io";
// Check if file exists
if (IO.fs.fileExists("data.txt")) {
// Read file content
const content = IO.fs.readFile("data.txt");
alert("File content: " + content);
}
// Write JSON data
const config = { theme: "dark", language: "en" };
IO.fs.writeJson("config.json", config);
// Copy files
IO.fs.copyFile("source.txt", "backup.txt");File Operations
KT-IO supports various file operations:
// File existence and metadata
const exists = IO.fs.fileExists("file.txt");
const size = IO.fs.getFileSize("file.txt");
const modified = IO.fs.getFileModifiedDate("file.txt");
// File operations
IO.fs.copyFile("source.txt", "dest.txt");
IO.fs.moveFile("old.txt", "new.txt");
IO.fs.deleteFile("temp.txt");
// Directory operations
IO.fs.createDirectory("logs", true); // recursive
const files = IO.fs.listFiles("data", /\.txt$/);High-level Utilities
KT-IO provides high-level utilities for common tasks:
// Create project structures from objects
const projectStructure = {
src: { components: {}, utils: {} },
docs: {},
tests: {},
};
IO.utils.createFolderTree(projectStructure, "/path/to/project");Build Scripts
To transpile for ExtendScript, run:
npm run buildDocumentation
For more detailed documentation, please refer to the specific README files in the docs folder:
Test Files
You can find the test files in the src/tests directory:
For more examples and detailed usage, please refer to the test files in the repository.
Links
License
MIT
