🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More
Socket
Sign inDemoInstall
Socket

@types/isomorphic-git__lightning-fs

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/isomorphic-git__lightning-fs - npm Package Compare versions

Comparing version

to
4.4.3

425

isomorphic-git__lightning-fs/index.d.ts

@@ -6,147 +6,310 @@ // Type definitions for @isomorphic-git/lightning-fs 4.4

/// <reference types="node" />
declare module '@isomorphic-git/lightning-fs' {
/**
* You can procrastinate initializing the FS object until later. And, if you're really adventurous, you can re-initialize it with a different name to switch between IndexedDb databases.
*/
class FS {
/**
* First, create or open a "filesystem".
* @param name This is used to determine the IndexedDb store name.
* @param options The "filesystem" configuration.
*/
constructor(name?: string, options?: FS.Options);
import { Stats } from 'fs';
/**
*
* @param name This is used to determine the IndexedDb store name.
* @param options The "filesystem" configuration.
*/
init(name: string, options?: FS.Options): void;
declare class LightningFS {
/** Collection of FS Operations that returns Promises */
promises: LightningFS.PromisifedFS;
/**
* Make directory
* @param filepath
* @param options
* @param cb
*/
mkdir(filepath: string, options: FS.MKDirOptions | undefined, cb: (err: Error) => void): void;
/** Initialise File System Backend */
init(name: string, opt?: LightningFS.FSConstructorOptions): void;
/** Activates Cache */
activate(): Promise<void>;
/** Deactivates Cache */
deactivate(): Promise<void>;
/** Reads File Content from Disk */
readFile(filePath: string, opts?: LightningFS.ReadFileOpts): Promise<Uint8Array>;
/** Writes File Content to Disk */
writeFile(filePath: string, data: Uint8Array, opts?: LightningFS.WriteFileOpts): Promise<void>;
/** Remove File from Disk */
unlink(filePath: string): Promise<void>;
/** Lists all files and sub-directory in given directory Path */
readdir(filePath: string): Promise<string[]>;
/** Creates Directory in Disk for given Path */
mkdir(filePath: string, opts?: LightningFS.DirOpts): Promise<void>;
/** Remove Directory from Disk */
rmdir(filePath: string): Promise<void>;
/** Rename File Name in Disk */
rename(oldFilepath: string, newFilepath: string): Promise<void>;
/** Unix File Stat from Disk */
stat(filePath: string): Promise<Stats>;
/** Unix File Stat from Disk */
lstat(filePath: string): Promise<Stats>;
/** Read Content of file targeted by a Symbolic Link */
readlink(filePath: string): Promise<string>;
/** Create Symbolic Link to a target file */
symlink(target: string, filePath: string): Promise<void>;
/**
* Remove directory
* @param filepath
* @param options
* @param cb
*/
rmdir(filepath: string, options: undefined, cb: (err: Error) => void): void;
constructor(id: string | number | symbol, opt?: LightningFS.FSConstructorOptions);
}
/**
* Read directory
*
* The callback return value is an Array of strings. NOTE: To save time, it is NOT SORTED. (Fun fact: Node.js' readdir output is not guaranteed to be sorted either. I learned that the hard way.)
* @param filepath
* @param options
* @param cb
*/
readdir(filepath: string, options: undefined, cb: (err: Error, files: string[]) => void): void;
declare namespace LightningFS {
interface FSConstructorOptions {
/** Delete the database and start with an empty filesystem. Default: false */
wipe: boolean;
/** Let readFile requests fall back to an HTTP request to this base URL */
url: string;
/** Fall back to HTTP for every read of a missing file, even if unbacked. Default: false */
urlauto: boolean;
/** Customize the database name */
fileDbName: string;
/** Customize the store name */
fileStoreName: string;
/** Customize the database name for the lock mutex */
lockDbName: string;
/** Customize the store name for the lock mutex */
lockStoreName: string;
/** If true, avoids mutex contention during initialization. Default: false */
defer: boolean;
writeFile(filepath: string, data: Uint8Array | string, options: FS.WriteFileOptions | undefined | string, cb: (err: Error) => void): void;
readFile(filepath: string, options: FS.ReadFileOptions | undefined | string, cb: (err: Error, data: Uint8Array | string) => void): void;
/**
* Delete a file
* @param filepath
* @param options
* @param cb
*/
unlink(filepath: string, options: undefined, cb: (err: Error) => void): void;
/**
* Rename a file or directory
* @param oldFilepath
* @param newFilepath
* @param cb
*/
rename(oldFilepath: string, newFilepath: string, cb: (err: Error) => void): void;
/**
* The result is a Stat object similar to the one used by Node but with fewer and slightly different properties and methods.
* @param filepath
* @param options
* @param cb
*/
stat(filepath: string, options: undefined, cb: (err: Error, stats: FS.Stats) => void): void;
/**
* Like fs.stat except that paths to symlinks return the symlink stats not the file stats of the symlink's target.
* @param filepath
* @param options
* @param cb
*/
lstat(filepath: string, options: undefined, cb: (err: Error, stats: FS.Stats) => void): void;
/**
* Create a symlink at filepath that points to target.
* @param target
* @param filepath
* @param cb
*/
symlink(target: string, filepath: string, cb: (err: Error) => void): void;
/**
* Read the target of a symlink.
* @param filepath
* @param options
* @param cb
*/
readlink(filepath: string, options: undefined, cb: (err: Error, linkString: string) => void): void;
/**
* Create or change the stat data for a file backed by HTTP. Size is fetched with a HEAD request.
* Useful when using an HTTP backend without urlauto set, as then files will only be readable if
* they have stat data. Note that stat data is made automatically from the file /.superblock.txt
* if found on the server. /.superblock.txt can be generated or updated with the included -
* [standalone script](https://github.com/isomorphic-git/lightning-fs/blob/main/src/superblocktxt.js).
* @param filepath
* @param options
* @param cb
*/
backFile(filepath: string, options: FS.BackFileOptions | undefined, cb: (err: Error) => void): void;
/**
* Returns the size of a file or directory in bytes.
* @param filepath
* @param cb
*/
du(filepath: string, cb: (err: Error, size: number) => void): void;
readonly promises: FS.PromisifiedFS;
}
namespace FS {
class PromisifiedFS {
/**
* If present, none of the other arguments(except `defer`) have any effect,
* and instead of using the normal LightningFS stuff, LightningFS acts as a wrapper around the provided custom backend.
*
* @param name This is used to determine the IndexedDb store name.
* @param options The "filesystem" configuration.
*/
backend: FSBackend;
}
init(name: string, options?: Options): void;
interface ReadFileOpts {
/** Encoding of Data */
encoding: 'utf8';
}
/**
* Make directory
* @param filepath
* @param options
*/
mkdir(filepath: string, options?: MKDirOptions): Promise<void>;
interface WriteFileOpts {
/** Encoding of Data */
encoding?: 'utf8' | undefined;
/** Unix Octet Represenation of File Mode */
mode: number;
}
/**
* Remove directory
* @param filepath
* @param options
*/
rmdir(filepath: string, options?: undefined): Promise<void>;
interface DirOpts {
/** Unix Octet Represenation of File Mode */
mode?: number | undefined;
}
/**
* Read directory
*
* The Promise return value is an Array of strings. NOTE: To save time, it is NOT SORTED.
* (Fun fact: Node.js' readdir output is not guaranteed to be sorted either. I learned that the hard way.)
* @param filepath
* @param options
* @returns The file list.
*/
readdir(filepath: string, options?: undefined): Promise<string[]>;
interface FSBackend {
/** Initialise File System Backend */
init(name: string, opt?: FSConstructorOptions): void;
/** Activates Cache */
activate(): Promise<void>;
/** Deactivates Cache */
deactivate(): Promise<void>;
/** Reads File Content from Disk */
readFile(filePath: string, opts: ReadFileOpts): Promise<Uint8Array>;
/** Writes File Content to Disk */
writeFile(filePath: string, data: Uint8Array, opts: WriteFileOpts): Promise<void>;
/** Remove File from Disk */
unlink(filePath: string): Promise<void>;
/** Lists all files and sub-directory in given directory Path */
readdir(filePath: string): string[];
/** Creates Directory in Disk for given Path */
mkdir(filePath: string, opts: DirOpts): void;
/** Remove Directory from Disk */
rmdir(filePath: string): void;
/** Rename File Name in Disk */
rename(oldFilepath: string, newFilepath: string): void;
/** Unix File Stat from Disk */
stat(filePath: string): Stats;
/** Unix File Stat from Disk */
lstat(filePath: string): Stats;
/** Read Content of file targeted by a Symbolic Link */
readlink(filePath: string): string;
/** Create Symbolic Link to a target file */
symlink(target: string, filePath: string): void;
}
writeFile(filepath: string, data: Uint8Array | string, options?: WriteFileOptions | string): Promise<void>;
interface PromisifedFS {
/** Initialise File System Backend */
init(name: string, opt?: FSConstructorOptions): void;
/** Activates Cache */
activate(): Promise<void>;
/** Deactivates Cache */
deactivate(): Promise<void>;
/** Reads File Content from Disk */
readFile(filePath: string, opts?: ReadFileOpts): Promise<Uint8Array>;
/** Writes File Content to Disk */
writeFile(filePath: string, data: Uint8Array, opts?: WriteFileOpts): Promise<void>;
/** Remove File from Disk */
unlink(filePath: string): Promise<void>;
/** Lists all files and sub-directory in given directory Path */
readdir(filePath: string): Promise<string[]>;
/** Creates Directory in Disk for given Path */
mkdir(filePath: string, opts?: DirOpts): Promise<void>;
/** Remove Directory from Disk */
rmdir(filePath: string): Promise<void>;
/** Rename File Name in Disk */
readFile(filepath: string, options?: ReadFileOptions | string): Promise<Uint8Array | string>;
/**
* Delete a file
* @param filepath
* @param options
*/
unlink(filepath: string, options?: undefined): Promise<void>;
/**
* Rename a file or directory
* @param oldFilepath
* @param newFilepath
*/
rename(oldFilepath: string, newFilepath: string): Promise<void>;
/** Unix File Stat from Disk */
stat(filePath: string): Promise<Stats>;
/** Unix File Stat from Disk */
lstat(filePath: string): Promise<Stats>;
/** Read Content of file targeted by a Symbolic Link */
readlink(filePath: string): Promise<string>;
/** Create Symbolic Link to a target file */
symlink(target: string, filePath: string): Promise<void>;
/**
* The result is a Stat object similar to the one used by Node but with fewer and slightly different properties and methods.
* @param filepath
* @param options
*/
stat(filepath: string, options?: undefined): Promise<Stats>;
/**
* Like fs.stat except that paths to symlinks return the symlink stats not the file stats of the symlink's target.
* @param filepath
* @param options
*/
lstat(filepath: string, options?: undefined): Promise<Stats>;
/**
* Create a symlink at filepath that points to target.
* @param target
* @param filepath
*/
symlink(target: string, filepath: string): Promise<void>;
/**
* Read the target of a symlink.
* @param filepath
* @param options
* @returns The link string.
*/
readlink(filepath: string, options?: undefined): Promise<string>;
/**
* Create or change the stat data for a file backed by HTTP. Size is fetched with a HEAD request.
* Useful when using an HTTP backend without urlauto set, as then files will only be readable if they have stat data.
* Note that stat data is made automatically from the file /.superblock.txt if found on the server. /.superblock.txt
* can be generated or updated with the included -
* [standalone script](https://github.com/isomorphic-git/lightning-fs/blob/main/src/superblocktxt.js).
* @param filepath
* @param options
*/
backFile(filepath: string, options?: BackFileOptions): Promise<void>;
/**
* @param filepath
* @returns The size of a file or directory in bytes.
*/
du(filepath: string): Promise<number>;
}
interface Options {
/**
* Delete the database and start with an empty filesystem
* @default false
*/
wipe?: boolean;
/**
* Let readFile requests fall back to an HTTP request to this base URL
* @default false
*/
url?: string;
/**
* Fall back to HTTP for every read of a missing file, even if unbacked
* @default false
*/
urlauto?: boolean;
/**
* Customize the database name
*/
fileDbName?: string;
/**
* Customize the store name
*/
fileStoreName?: string;
/**
* Customize the database name for the lock mutex
*/
lockDbName?: string;
/**
* Customize the store name for the lock mutex
*/
lockStoreName?: string;
/**
* If true, avoids mutex contention during initialization
* @default false
*/
defer?: boolean;
}
interface MKDirOptions {
/**
* Posix mode permissions
* @default 0o777
*/
mode: number;
}
interface WriteFileOptions {
/**
* Posix mode permissions
* @default 0o777
*/
mode: number;
encoding?: 'utf8';
}
interface ReadFileOptions {
encoding?: 'utf8';
}
interface Stats {
type: 'file' | 'dir';
mode: any;
size: number;
ino: any;
mtimeMs: any;
ctimeMs: any;
uid: 1;
gid: 1;
dev: 1;
isFile(): boolean;
isDirectory(): boolean;
isSymbolicLink(): boolean;
}
interface BackFileOptions {
/**
* Posix mode permissions
* @default 0o666
*/
mode: number;
}
}
}
export = FS;
}
export = LightningFS;
declare module '@isomorphic-git/lightning-fs/src/path' {
namespace Path {
function join(...parts: string[]): string;
function normalize(path: string): string;
function split(path: string): string[];
function basename(path: string): string;
function dirname(path: string): string;
function resolve(...paths: string[]): string;
}
export = Path;
}
{
"name": "@types/isomorphic-git__lightning-fs",
"version": "4.4.2",
"version": "4.4.3",
"description": "TypeScript definitions for @isomorphic-git/lightning-fs",

@@ -22,7 +22,5 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/isomorphic-git__lightning-fs",

"scripts": {},
"dependencies": {
"@types/node": "*"
},
"typesPublisherContentHash": "09db5ea87759c97daec5ad03d66d2c6a120c8aa6f50376ad53f26a80fbf76025",
"typeScriptVersion": "3.6"
"dependencies": {},
"typesPublisherContentHash": "5dd5812807127d0176846cfbf736f4d8aad55c61a2f26e61a7053e06d5a41d4f",
"typeScriptVersion": "3.9"
}

@@ -11,4 +11,4 @@ # Installation

### Additional Details
* Last updated: Thu, 08 Jul 2021 14:23:20 GMT
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
* Last updated: Tue, 15 Mar 2022 18:01:47 GMT
* Dependencies: none
* Global values: none

@@ -15,0 +15,0 @@