Node Installation and Basics

Source: Internet
Author: User

Http://stackoverflow.com/questions/22504566/renaming-files-using-node-js
Elon Musk 13:45:44
Why Rename with node
Future Game Studio 13:45:51
You'll need to use FS for that:http://nodejs.org/api/fs.html

And in particular the Fs.rename () function:

var fs = require (' FS ');
Fs.rename ('/path/to/afghanistan.png ', '/path/to/af.png ', function (err) {
if (err) console.log (' ERROR: ' + err);
});
Future Game Studio 13:46:09
So after all things automation code implementation
Future Game Studio 13:46:35
Lower load name change data
Future Game Studio 13:49:58
Webstorm How long to download
Elon Musk 13:50:33
I'll try it with thunder.
Elon Musk 13:51:09
I don't even understand. What is the file path for Mac?
Elon Musk 13:51:28
Hard drive, what?
Elon Musk 13:51:31
Where are the files stored?
Elon Musk 13:51:53

Future Game Studio 13:51:58
In your terminal
Future Game Studio 13:52:08
Open Iterm
Future Game Studio 13:52:16
Enter Open.
Future Game Studio 13:52:35
Then drag this folder to your favorites
Elon Musk 13:53:09
What?
Elon Musk 13:53:35

Elon Musk 13:53:41
That folder
Elon Musk 13:53:45
Which one
Future Game Studio 13:54:01
Input
Future Game Studio 13:54:04
Open/.
Future Game Studio 13:54:06
Open.
Future Game Studio 13:54:15
Automatically open the current folder
Elon Musk 13:54:37
What do you mean by now?
Future Game Studio 13:54:47


Elon Musk 13:55:00
Oh
Future Game Studio 13:55:01
The folder where the terminal is located
Future Game Studio 13:55:12
Cd..
Future Game Studio 13:55:22
Parent Directory
Future Game Studio 13:55:27
and then open.
Future Game Studio 13:55:36
It's up to the boss.
Future Game Studio 13:55:47
and drag your folder to your personal collection.
Future Game Studio 13:55:53


Future Game Studio 13:56:03
In the future, your personal collection will have your terminal directory.
Elon Musk 13:56:10


Elon Musk 13:56:24
Open. Open this.
Future Game Studio 13:56:55
Cd..
Future Game Studio 13:56:58
There are spaces
Elon Musk 13:57:16


Open.
Future Game Studio 13:57:46
Put the MA folder
Future Game Studio 13:57:50
Drag to personal collection




Elon Musk 13:58:32
Get
Elon Musk 13:58:35
Why are you doing this?
Future Game Studio 13:58:38
This way, your terminal
Future Game Studio 13:58:42
Talk to your Mac
Future Game Studio 13:58:44
It corresponds to the
Future Game Studio 13:58:53
You open the terminal is the MA folder
Future Game Studio 13:58:54
Got it?
Elon Musk 13:59:04
Oh
Future Game Studio 13:59:10
In the future you will use Webstorm
Future Game Studio 13:59:12
Select Folder
Elon Musk 13:59:14
What does a personal collection mean?
Future Game Studio 13:59:15
You can see the MA.
Future Game Studio 13:59:17
I didn't see it before.
Elon Musk 13:59:28
Oh
Future Game Studio 13:59:31
Upload the download file and you'll see the MA.

Future Game Studio 14:02:32
See FS Code First
Future Game Studio 14:02:46
var fs = require (' FS ');
Fs.rename ('/path/to/afghanistan.png ', '/path/to/af.png ', function (err) {
if (err) console.log (' ERROR: ' + err);
});
Future Game Studio 14:02:49
First line
Future Game Studio 14:02:56
Onboarding the FS Library
Future Game Studio 14:03:02
Then use the FS function rename
Elon Musk 14:03:38
Like I rename this.
Elon Musk 14:03:39

Elon Musk 14:03:42
0711
Future Game Studio 14:04:34
The file is not the same as the folder.
Future Game Studio 14:04:38
Learn documents First
Elon Musk 14:05:36
I'll try, huh?
Future Game Studio 14:05:55
Wait for Webstrom to finish downloading
Future Game Studio 14:06:01
You can't run node right now.

Future Game Studio 14:12:58
After the Webstorm
Future Game Studio 14:13:00
Direct run
Future Game Studio 14:13:07
JS file

Node Installation and Basics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.