Skip to content

Commit

Permalink
Create sync functons (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
willybrauner authored Mar 26, 2024
1 parent 211723d commit 8ccc20e
Show file tree
Hide file tree
Showing 6 changed files with 451 additions and 93 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
node_modules
dist
tests/tmp/*
tests/tmp-sync/*
!tests/tmp/.gitkeep
.idea
!tests/tmp-sync/.gitkeep
.idea
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { * as mfs } from '@wbe/mfs';

## API

### Async functions

- fileExists

```ts
Expand Down Expand Up @@ -94,6 +96,76 @@ function copyDir(
): Promise<void>
```


### Sync functions

- fileExistsSync

```ts
function fileExistsSync(path: string): boolean
```

- createFileSync

```ts
function createFileSync(path: string, content?: string): void
```

- readFileSync

```ts
function readFileSync(path: string): string
```

- removeFileSync

```ts
function removeFileSync(path: string): boolean
```

- copyFileSync

```ts
function copyFileSync(
src: string,
dest: string,
{
transform,
force,
}: { transform?: (content: string) => string; force?: boolean }
): void
```

- dirExistsSync

```ts
function dirExistsSync(path: string): boolean
```

- readDirSync

```ts
function readDirSync(path: string, recursive = true): string[]
```

- removeDirSync

```ts
function removeDirSync(path: string): void
```

- createDirSync

```ts
function createDirSync(path: string): string | undefined
```

- copyDirSync

```ts
function copyDirSync(src: string, dest: string, { force }: { force?: boolean } = {}): void
```

## License

MIT
Expand Down
Loading

0 comments on commit 8ccc20e

Please sign in to comment.