[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/thorgits/nodegit-example/master/clone.js [Back]  [Original]

'use strict';

const Git = require("nodegit");
const pkg = require('./package');
const cnst = require('./constant');

const Clone = Git.Clone.clone;
/*
if you use not NFS filesystem, error would comes to you!
-----------------------
Failed to mmap. Could not write data: Invalid argument
Error: Failed to mmap. Could not write data: Invalid argument
    at Error (native)
-----------------------
help from GitHub: https://github.com/nodegit/nodegit/issues/1115
it's the filesystem cause it
 */

let cloneOptions = {};
cloneOptions.fetchOpts = {
	callbacks: {
      certificateCheck: () => {
        return 1;
      }
    }
};
// repo
Clone(
	pkg.repository.url, 
	`${cnst.tmp_dir}/${pkg.name}`,
	cloneOptions
)
.then((repo) => {
	console.log('repo done!');
})
.catch((e) => {
	console.log(e.message);
	console.log(e.stack);
});

Web Proxy Viewer  |  New URL  |  Original Page