Compress files synchronously in javascript

javascript react js node js 6 years, 1 month ago
const tar = require('tar'); tar.c( { gzip: false, file: 'tarDemo.tar', // exported file name C: '/home/koderplace/tarDemo', // The path what you want to export sync: true, // flag helpful to write files synchronously }, ['.'], // Write only sub folders );
1675
Instructions

try to install 'tar' using npm and then try.
Happy Coding :-)

Posted By
Run shell files in javascript
//JS Code
function runShellScript(){
    const process = require('child_proce
javascript shell node js
harika
delete a folder in javascript
// Delete the files recursively.
//fs is a built in node module.
const fs = require('fs');
javascript node js
harika
Write string or json objects directly to a fi
const fs = require('fs');
//fs is a built in module in node js
const filePath = '/Desktop/Test.json';
javascript node js
harika
Check whether the file node is a directory or
//fs is a built in node module
const fs = require('fs');
const filePath = "/home/Desktop"
javascript node js
harika
Extract files synchronously in javascript
const tar = require('tar');
  tar.x(
    {
node js javascript react js
harika
Command line arguments parsing in NodeJS with
const yargs = require("yargs")

yargs.command({
javascript node js
kishore_kumar
Make a Get Request to url or to an api end po
const request = require("request")

const url = "https://reqres.in/api/users
javascript node js
kishore_kumar
Create a simple web server with express using
const express = require('express')

const app = express()
express javascript node js
kishore_kumar
Connect to Mongo DB and insert documents in N
const mongodb = require("mongodb")
const mongo_client = mongodb.MongoClient

javascript node js mongodb
kishore_kumar
Find Documents in Mongo db using Node JS
const mongodb = require("mongodb")
const mongo_client = mongodb.MongoClient

javascript node js mongodb
kishore_kumar
Create a model and save document in Mongo db
const mongoose = require("mongoose")

mongoose.connect("mongodb://127.0.0.1:27
mongoose javascript node js
kishore_kumar
print "hello world" in node js
console.log("hello world")
helloworld javascript node js
Reshma
Work with inline styles in React js
//plugin to any test js file and proceed
//This is the best standard to work with
const style = {background:'cyan', color:
javascript react js css
harika
Work with 3rd party css libraries in react fr
import React from 'react'
//No need to give the complete path, rea
//If not exists searches globally
javascript react js
harika
work with react without node installation in
//Basic way
<!DOCTYPE html>
<html>
javascript react js html
harika
Difference between state and stateless compon
//State Component
<!DOCTYPE html>
<html>
javascript react js
harika
Create a React app without webpack and Create
//Basic way
<!DOCTYPE html>
<html>
javascript react js webpack
harika
JQuery toggle functionality in react
import React from 'react'
export default class ToggleComponent ext
  constructor(props){
javascript react js
harika
display state inside any html tag
import React from 'react'
export default class StateProps extends 

javascript react js
harika
Import any class irrespective of default expo
import React, { Component } from 'react'
javascript react js
harika