MISC: Add file metadata (timestamps) (#2199)

This commit is contained in:
catloversg
2025-06-17 06:34:06 +07:00
committed by GitHub
parent e5bfa641e1
commit a794fddaf7
19 changed files with 297 additions and 30 deletions

View File

@@ -4,6 +4,20 @@
type _ValueOf<T> = T[keyof T];
/** All netscript definitions */
/**
* Metadata of a file
* @public
*/
interface FileMetadata {
/** Time of Access */
atime: number;
/** Time of Modification */
mtime: number;
/** Time of Birth (creation) */
btime: number;
}
/** @public */
interface HP {
current: number;
@@ -7708,6 +7722,19 @@ export interface NS {
*/
read(filename: string): string;
/**
* Get the metadata of a file.
* @remarks
* RAM cost: 0 GB
*
* This function returns the metadata associated with the specified file.
*
* @param filename - Name of the file to read the metadata from. It must be a text file (.txt, .json) or a script
* (.js, .jsx, .ts, .tsx).
* @Returns The metadata of the file.
*/
getFileMetadata(filename: string): FileMetadata;
/**
* Get a copy of the data from a port without popping it.
* @remarks