summaryrefslogtreecommitdiff
path: root/std/fs
diff options
context:
space:
mode:
Diffstat (limited to 'std/fs')
-rw-r--r--std/fs/README.md34
1 files changed, 23 insertions, 11 deletions
diff --git a/std/fs/README.md b/std/fs/README.md
index e2483df1e..57a15d781 100644
--- a/std/fs/README.md
+++ b/std/fs/README.md
@@ -14,7 +14,10 @@ is not empty. If the directory does not exist, it is created. The directory
itself is not deleted.
```ts
-import { emptyDir, emptyDirSync } from "https://deno.land/std/fs/mod.ts";
+import {
+ emptyDir,
+ emptyDirSync,
+} from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
emptyDir("./foo"); // returns a promise
emptyDirSync("./foo"); // void
@@ -26,7 +29,10 @@ Ensures that the directory exists. If the directory structure does not exist, it
is created. Like `mkdir -p`.
```ts
-import { ensureDir, ensureDirSync } from "https://deno.land/std/fs/mod.ts";
+import {
+ ensureDir,
+ ensureDirSync,
+} from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
ensureDir("./bar"); // returns a promise
ensureDirSync("./ensureDirSync"); // void
@@ -39,7 +45,10 @@ directories that do not exist, these directories are created. If the file
already exists, it is **NOT MODIFIED**.
```ts
-import { ensureFile, ensureFileSync } from "https://deno.land/std/fs/mod.ts";
+import {
+ ensureFile,
+ ensureFileSync,
+} from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
ensureFile("./folder/targetFile.dat"); // returns promise
ensureFileSync("./folder/targetFile.dat"); // void
@@ -54,7 +63,7 @@ created.
import {
ensureSymlink,
ensureSymlinkSync,
-} from "https://deno.land/std/fs/mod.ts";
+} from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
ensureSymlink("./folder/targetFile.dat", "./folder/targetFile.link.dat"); // returns promise
ensureSymlinkSync("./folder/targetFile.dat", "./folder/targetFile.link.dat"); // void
@@ -65,7 +74,7 @@ ensureSymlinkSync("./folder/targetFile.dat", "./folder/targetFile.link.dat"); //
Detects and format the passed string for the targeted End Of Line character.
```ts
-import { format, detect, EOL } from "https://deno.land/std/fs/mod.ts";
+import { format, detect, EOL } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
const CRLFinput = "deno\r\nis not\r\nnode";
const Mixedinput = "deno\nis not\r\nnode";
@@ -86,7 +95,10 @@ format(CRLFinput, EOL.LF); // output "deno\nis not\nnode"
Test whether or not the given path exists by checking with the file system.
```ts
-import { exists, existsSync } from "https://deno.land/std/fs/mod.ts";
+import {
+ exists,
+ existsSync,
+} from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
exists("./foo"); // returns a Promise<boolean>
existsSync("./foo"); // returns boolean
@@ -97,7 +109,7 @@ existsSync("./foo"); // returns boolean
Moves a file or directory. Overwrites it if option provided.
```ts
-import { move, moveSync } from "https://deno.land/std/fs/mod.ts";
+import { move, moveSync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
move("./foo", "./bar"); // returns a promise
moveSync("./foo", "./bar"); // void
@@ -110,7 +122,7 @@ moveSync("./foo", "./existingFolder", { overwrite: true });
copy a file or directory. Overwrites it if option provided.
```ts
-import { copy, copySync } from "https://deno.land/std/fs/mod.ts";
+import { copy, copySync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
copy("./foo", "./bar"); // returns a promise
copySync("./foo", "./bar"); // void
@@ -123,7 +135,7 @@ copySync("./foo", "./existingFolder", { overwrite: true });
Iterate all files in a directory recursively.
```ts
-import { walk, walkSync } from "https://deno.land/std/fs/mod.ts";
+import { walk, walkSync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
for (const entry of walkSync(".")) {
console.log(entry.path);
@@ -145,7 +157,7 @@ Expand the glob string from the specified `root` directory and yield each result
as a `WalkEntry` object.
```ts
-import { expandGlob } from "https://deno.land/std/fs/mod.ts";
+import { expandGlob } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
for await (const file of expandGlob("**/*.ts")) {
console.log(file);
@@ -157,7 +169,7 @@ for await (const file of expandGlob("**/*.ts")) {
Synchronous version of `expandGlob()`.
```ts
-import { expandGlobSync } from "https://deno.land/std/fs/mod.ts";
+import { expandGlobSync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
for (const file of expandGlobSync("**/*.ts")) {
console.log(file);