உள்ளடக்கத்திற்குச் செல்லவும்

JavaScript ஐ எங்கும் இயக்க

Node.js® என்பது ஒரு இலவச, திறந்த மூல மென்பொருளாகும். இது பல்வேறு இயக்கத் தளங்களில் JavaScript ஐ இயக்க உதவும் சூழலாகும். இதன் மூலம் டெவலப்பர்கள் சர்வர்கள், வெப் பயன்பாடுகள், கட்டளை வரி கருவிகள் மற்றும் ஸ்கிரிப்ட்களை உருவாக்க முடியும்.

// server.mjs
import {  } from 'node:http';

const  = ((, ) => {
  .(200, { 'Content-Type': 'text/plain' });
  .('Hello World!\n');
});

// starts a simple http server locally on port 3000
.(3000, '127.0.0.1', () => {
  .('Listening on 127.0.0.1:3000');
});

// run with `node server.mjs`
// tests.mjs
import  from 'node:assert';
import  from 'node:test';

('that 1 is equal 1', () => {
  .(1, 1);
});

('that throws as 1 is not equal 2', () => {
  // throws an exception because 1 != 2
  .(1, 2);
});

// run with `node tests.mjs`
// crypto.mjs
import {  } from 'node:crypto';
import {  } from 'node:fs/promises';

const  = ('sha1');

.('hex');
// ensure you have a `package.json` file for this test!
.(await ('package.json'));
.();

const  = .();

// run with `node crypto.mjs`
// streams.mjs
import { ,  } from 'node:fs';
import {  } from 'node:stream/promises';
import {  } from 'node:zlib';

// ensure you have a `package.json` file for this test!
await (
  ('package.json'),
  (),
  ('package.json.gz')
);


// run with `node streams.mjs`
// threads.mjs
import { , ,
  ,  } from 'node:worker_threads';

if () {
  const  = 'some data';
  const  = new (import.meta., { :  });
  .('message',  => .('Reply from Thread:', ));
} else {
  const  = ;
  .((.toUpperCase()));
}

// run with `node threads.mjs`

Node.js என்ன செய்ய முடியும் என்பதை எங்கள் கற்றல் வளங்கள்மூலம் மேலும் தெரிந்து கொள்ளுங்கள்.