HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //var/www/blog.affstore/node_modules/.bin/sorcery
#!/usr/bin/env node

var path = require( 'path' );
var minimist = require( 'minimist' );
var sander = require( 'sander' );
var showHelp = require( './showHelp' );
var command;
var sorcery = require( '../' );

var validExtensions = { js: true };

command = minimist( process.argv.slice( 2 ), {
	alias: {
		i: 'input',
		o: 'output',
		v: 'version',
		h: 'help',
		d: 'datauri',
		x: 'excludeContent'
	}
});

if ( command.help ) {
	showHelp( process.stdout );
}

else if ( process.argv.length <= 2 && process.stdin.isTTY ) {
	showHelp( process.stderr );
}

else if ( command.version ) {
	console.log( 'Sorcery version ' + require( '../package.json' ).version );
}

else if ( !command.input ) {
	console.error( 'Error: You must supply an --input (-i) argument. Type sorcery --help for more info' );
}

else {
	sander.stat( command.input ).then( function ( stats ) {
		if ( stats.isDirectory() ) {
			return sander.lsr( command.input ).then( function ( files ) {
				files = files.filter( function ( file ) {
					return validExtensions[ path.extname( file ).slice( 1 ) ];
				});

				return files.reduce( function ( promise, file ) {
					return promise.then( function () {
						var input = path.join( command.input, file );
						var output = path.join( command.output || command.input, file );

						return sorcery.load( input ).then( function ( chain ) {
							return chain.write( output, {
								inline: command.datauri,
								includeContent: !command.excludeContent
							});
						});
					});
				}, Promise.resolve() );
			});
		}

		return sorcery.load( command.input ).then( function ( chain ) {
			return chain.write( command.output || command.input, {
				inline: command.datauri,
				includeContent: !command.excludeContent
			});
		});
	}).catch( function ( err ) {
		setTimeout( function () {
			throw err;
		});
	});
}