IT 207 - Nodejs Synchronous File Systems APIs

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/47

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

48 Terms

1
New cards

What is a filesystem

major component of any operating system

2
New cards

What is a filesystem responsible for?

Persistently storing, managing, and updating data on a storage device

3
New cards

File systems 2 abstractions

Files and directories

4
New cards

Files

The smallest unit of persistent data storage

5
New cards

File

linear array of bytes, each of which can be read or written

6
New cards

How are files identified?

A textual name with 2 parts separated by a dot: unique file name and file type extension

7
New cards

File properties

File size (bytes), file creation date, file access date, default application for file, and access permissions stating who can read, write, and execute file

8
New cards

What is a Directory?

a container for files

9
New cards

How are directories organized?

Hierarchal structure such as a tree

<p>Hierarchal structure such as a tree</p>
10
New cards

How are directories identified?

textual name and low-level name

11
New cards

What is a path?

The sequence of directory names that starts from the root directory and specifies subsequent directories until the desired file is reached

12
New cards

How does a path separate directory names?

special characters

13
New cards

What does ./ refer to?

The current directory

14
New cards

What does ../ refer to?

The parent directory

15
New cards

cat

print file content

16
New cards

cp

copy file

17
New cards

mkdir

make directory

18
New cards

ls

list files and directories

19
New cards

rm

remove file

20
New cards

rmdir

remove directory

21
New cards

pwd

print working directory

22
New cards

mv

move file

23
New cards

touch

create, change, and modify timestamps of a file

24
New cards

Node Buffer

special objects that handle binary data and are used to represent a fixed-length of bytes

25
New cards

What scope is buffer class available within?

global scope

26
New cards

Functions that work on buffers

alloc()
toString()
write()
length

27
New cards

alloc()

Creates a buffer object of a specified length

28
New cards

toString()

Returns the string version of a buffer object

29
New cards

write()

Writes a specified string to a buffer object

30
New cards

length

Returns the length of a buffer object in bytes

31
New cards

built-in modules

path and fs

32
New cards

path

provides utilities for working with file and directory paths

33
New cards

fs

enables interacting with the fie system in a way modeled on standard POSIX functions

34
New cards

Environment variables

_filename, _dirname

35
New cards

_filename

holds the absolute file name of the current module

36
New cards

_dirname

holds the directory name of the current module

37
New cards

What 3 categories does Nodejs fs module provide for accessing files?

Synchronous APIs, Callback APIs, and Promise APIs

38
New cards

Which are Asynchronous APIs?

Callback APIs and Promise APIs

39
New cards

All synchronous functions will have the term ____ added to their name

Sync

<p>Sync </p>
40
New cards

Creating a directory in JS

fs.mkdirSync(path[, options])

41
New cards

Read the contents of a directory

fs.readdirSync(path[, options])

42
New cards

remove a directory

fs.rmdirSync (path[, options])

43
New cards

File reading functions

readFileSync(path[, options])

readSync(fd, buffer, offset, length[, position])

readSync(fd, buffer[, options])

44
New cards

Reading the status of a file function

statsSync(path[, options])

45
New cards

Writing to a file functions

writeFileSync(file, data[, options])

writeSync(fd, buffer, offset[, length[, position]])

writeSync(fd, buffer[, options])

writeSync(fd, string[, position[, encoding]])

appendFileSync(path, data[, options])

46
New cards

You cannot remove a folder with files, only ones that are empty

True

47
New cards

Nodejs provides the ____ object which has information about, and control over, the current Nodejs process

process.argv

48
New cards

process.argv

holds the command line arguments passed to the Nodejs process when it is launched