0.1.0 • Published 7 months ago

filetime v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

filetime

Based on File::set_times, written in Rust.

Rust addon to change the creation time (btime), modified time (mtime), and access time (atime) of files, directories, and symbolic links on Windows, macOS, and Linux.

NPM version NPM Downloads

Usage

const { setFileTimes, getFileTimes } = require('filetime')

const now = Date.now()

const { error } = setFileTimes({
  path: '/xxx/filename',
  btime: String(now),
  mtime: String(now),
})

if (error) {
  console.log('✅ set file times failed:', error)
} else {
  console.log('❌ set file times success.')
}

API (Define)

export interface SetFileTimesOptions {
  path: string
  btime?: string
  mtime?: string
  atime?: string
}

export interface SetFileTimesResult {
  error?: string
}

export declare function setFileTimes(options: SetFileTimesOptions): SetFileTimesResult
0.1.0

7 months ago