@ainc/fs

file system

Usage no npm install needed!

<script type="module">
  import aincFs from 'https://cdn.skypack.dev/@ainc/fs';
</script>

README

@ainc/fs

file system

Install

$ yarn add @ainc/fs

Usage

import * as fs from '@ainc/fs';

API

  • homedir(): string;
  • cwd(...args: string[]): string;
  • stat(file: string): Stats | null;
  • lstat(file: string): Stats | null;
  • dirname(dir: string): string;
  • filename(file: string): string;
  • basename(file: string, ext?: string): string
  • extname(file: string): string;
  • readFile(path: string): string;
  • writeFile(path: string, content: string | Buffer): void;
  • unlink(path: string): boolean;
  • symlink(src: string, dest: string, options?: Options): void;
  • copy(src: string, dest: string, options?: Options): void;
  • isDirectory(file: string): boolean;
  • indir(dir: string, file: string): boolean;
  • indir(dir: string): (file: string) => boolean;
  • mkdir(dir: string): string;
  • rmdir(dir: string): boolean;
  • readdir(dir: string): State[]
  • cpdir(src: string, dist: string, handler: Handler): string[];
  • mapdir(dir: string, handler: Handler): T[];
  • usedir(...basedir: string[]): (...args: string[]) => string;
  • supdir(dir: string, handler: Handler): T | undefined;
  • resolve(dir: string | string[], options?: Options): Asset[];
  • relative(from: string, to: string): string;
  • find(name: string, dir = '.', options?: Options): string[];
  • finddir(name: string, dir = '.', options: Options): string[];
  • findFile(name: string, dir = '.', options?: Options): string[];
  • json(file: string): object | null;
  • json(file: string, data: object): object | null;
  • resolveAlias(options: Options): ResolvePath;
  • isAbsolutePath(source: string): boolean;
  • isRelativePath(source: string): boolean;
  • includePaths(paths: string[]): (source: string) => boolean;