Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Test
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sandeep Jha
Test
Commits
28b98a03
Commit
28b98a03
authored
Jul 4, 2023
by
Sandeep Jha
Browse files
Options
Downloads
Patches
Plain Diff
first commit
parent
27a40064
Branches
master
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
index.js
+34
-0
34 additions, 0 deletions
index.js
with
34 additions
and
0 deletions
index.js
0 → 100644
+
34
−
0
View file @
28b98a03
const
fs
=
require
(
'
fs/promises
'
)
let
counter
=
1
let
myFiles
=
`new
${
counter
}
.html`
//create Promise
const
pro
=
new
Promise
((
resolve
,
reject
)
=>
{
resolve
(
'
Hello World
'
)
reject
(
'
error occured
'
)
}).
then
((
res
)
=>
{
console
.
log
(
res
)
}).
catch
((
err
)
=>
{
console
.
log
(
err
)
})
//create new file
async
function
readingDirectory
()
{
const
fileNames
=
await
fs
.
readdir
(
__dirname
);
counter
=
fileNames
.
length
+
1
myFiles
=
`new
${
counter
}
.html`
const
html
=
`<h1> hello
${
counter
}
</h1>`
await
fs
.
appendFile
(
__dirname
+
'
/
'
+
myFiles
,
html
,)
}
readingDirectory
().
then
(()
=>
{
console
.
log
(
`file created
${
myFiles
}
`
);
}).
catch
(
err
=>
{
console
.
log
(
err
);
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment