0.3.6 • Published 9 months ago

@neurodevs/node-file-checker v0.3.6

Weekly downloads
-
License
-
Repository
github
Last release
9 months ago

node-file-checker

Check whether file exists with optional timeout

Installation

npm install @neurodevs/node-file-checker

Static Creation Method

import { FileCheckerImpl } from '@neurodevs/node-file-checker'

const checker = FileCheckerImpl.Checker()

Check If File Exists

import { FileCheckerImpl } from '@neurodevs/node-file-checker'

const path = '...'
const checker = FileCheckerImpl.Checker()

// Needs to be in an async function
const wasFound = await checker.checkIfFileExists(path)

Check with a Timeout (Default: No timeout)

import { FileCheckerImpl } from '@neurodevs/node-file-checker'

const path = '...'
const timeoutMs = 1000

const checker = FileCheckerImpl.Checker({ timeoutMs })

// Needs to be in an async function
const wasFound = await checker.checkIfFileExists(path)

Use a Test Double in Your Tests

import { FileCheckerImpl, FakeFileChecker } from '@neurodevs/node-file-checker'

FileCheckerImpl.Class = FakeFileChecker
const fakeChecker = FileCheckerImpl.Checker()

Create Your Own Test Double

import { FileChecker } from '@neurodevs/node-file-checker'

class MockFileChecker implements FileChecker {
    ...
}

FileCheckerImpl.Class = MockFileChecker
const mockChecker = FileCheckerImpl.Checker()
0.3.6

9 months ago

0.3.5

9 months ago

0.3.4

9 months ago

0.3.3

10 months ago

0.3.2

12 months ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago