commit
0073d80258
8054 changed files with 782110 additions and 0 deletions
@ -0,0 +1,46 @@ |
||||
var createError = require('http-errors'); |
||||
var express = require('express'); |
||||
var path = require('path'); |
||||
var cookieParser = require('cookie-parser'); |
||||
var logger = require('morgan'); |
||||
|
||||
var indexRouter = require('./routes/index'); |
||||
var usersRouter = require('./routes/users'); |
||||
var addIconRouter = require('./routes/creator'); |
||||
|
||||
var Db = require('./models/iconFontmodels'); |
||||
const { append } = require('express/lib/response'); |
||||
var app = express(); |
||||
Db.relations() |
||||
// view engine setup
|
||||
app.set('views', path.join(__dirname, 'views')); |
||||
app.set('view engine', 'ejs'); |
||||
|
||||
app.use(logger('dev')); |
||||
app.use(express.json()); |
||||
app.use(express.urlencoded({ extended: false })); |
||||
app.use(cookieParser()); |
||||
app.use(express.static(path.join(__dirname, 'public'))); |
||||
|
||||
app.use('/', indexRouter); |
||||
app.use('/users', usersRouter); |
||||
app.use('/creator',addIconRouter); |
||||
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function(req, res, next) { |
||||
next(createError(404)); |
||||
}); |
||||
|
||||
// error handler
|
||||
app.use(function(err, req, res, next) { |
||||
// set locals, only providing error in development
|
||||
res.locals.message = err.message; |
||||
res.locals.error = req.app.get('env') === 'development' ? err : {}; |
||||
|
||||
// render the error page
|
||||
res.status(err.status || 500); |
||||
res.render('error'); |
||||
}); |
||||
|
||||
module.exports = app; |
@ -0,0 +1,90 @@ |
||||
#!/usr/bin/env node |
||||
|
||||
/** |
||||
* Module dependencies. |
||||
*/ |
||||
|
||||
var app = require('../app'); |
||||
var debug = require('debug')('testapp:server'); |
||||
var http = require('http'); |
||||
|
||||
/** |
||||
* Get port from environment and store in Express. |
||||
*/ |
||||
|
||||
var port = normalizePort(process.env.PORT || '5000'); |
||||
app.set('port', port); |
||||
|
||||
/** |
||||
* Create HTTP server. |
||||
*/ |
||||
|
||||
var server = http.createServer(app); |
||||
|
||||
/** |
||||
* Listen on provided port, on all network interfaces. |
||||
*/ |
||||
|
||||
server.listen(port); |
||||
server.on('error', onError); |
||||
server.on('listening', onListening); |
||||
|
||||
/** |
||||
* Normalize a port into a number, string, or false. |
||||
*/ |
||||
|
||||
function normalizePort(val) { |
||||
var port = parseInt(val, 10); |
||||
|
||||
if (isNaN(port)) { |
||||
// named pipe |
||||
return val; |
||||
} |
||||
|
||||
if (port >= 0) { |
||||
// port number |
||||
return port; |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* Event listener for HTTP server "error" event. |
||||
*/ |
||||
|
||||
function onError(error) { |
||||
if (error.syscall !== 'listen') { |
||||
throw error; |
||||
} |
||||
|
||||
var bind = typeof port === 'string' |
||||
? 'Pipe ' + port |
||||
: 'Port ' + port; |
||||
|
||||
// handle specific listen errors with friendly messages |
||||
switch (error.code) { |
||||
case 'EACCES': |
||||
console.error(bind + ' requires elevated privileges'); |
||||
process.exit(1); |
||||
break; |
||||
case 'EADDRINUSE': |
||||
console.error(bind + ' is already in use'); |
||||
process.exit(1); |
||||
break; |
||||
default: |
||||
throw error; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Event listener for HTTP server "listening" event. |
||||
*/ |
||||
|
||||
function onListening() { |
||||
var addr = server.address(); |
||||
var bind = typeof addr === 'string' |
||||
? 'pipe ' + addr |
||||
: 'port ' + addr.port; |
||||
debug('Listening on ' + bind); |
||||
} |
@ -0,0 +1,20 @@ |
||||
|
||||
@font-face { |
||||
font-family: iconsax2; |
||||
src: url('iconsax2.eot'); /* IE9*/ |
||||
src: url('iconsax2.eot') format('embedded-opentype'), /* IE6-IE8 */ |
||||
url("iconsax2.woff2") format("woff2"), |
||||
url("iconsax2.woff") format("woff"), |
||||
url('iconsax2.ttf') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ |
||||
url('iconsax2.svg') format('svg'); /* iOS 4.1- */ |
||||
} |
||||
|
||||
.characters { |
||||
font-family: 'iconsax2' !important; |
||||
font-size:16px; |
||||
font-style:normal; |
||||
-webkit-font-smoothing: antialiased; |
||||
-moz-osx-font-smoothing: grayscale; |
||||
} |
||||
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 2.4 MiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,66 @@ |
||||
const { Sequelize, DataTypes, where, BIGINT } = require('sequelize'); |
||||
|
||||
const sequelize = new Sequelize('iconFont', 'postgres', '2783Rtda', { |
||||
host: 'localhost', |
||||
dialect:'postgres', |
||||
port:3000, |
||||
|
||||
}); |
||||
|
||||
|
||||
const font = sequelize.define('font', { |
||||
id :{ |
||||
type : DataTypes.BIGINT, |
||||
primaryKey: true, |
||||
autoIncrement:true, |
||||
}, |
||||
|
||||
name :{ |
||||
type : DataTypes.STRING, |
||||
allowNull: false, |
||||
} |
||||
}) |
||||
|
||||
|
||||
|
||||
const iconfont = sequelize.define('iconfont', { |
||||
id :{ |
||||
type : DataTypes.BIGINT, |
||||
primaryKey: true, |
||||
autoIncrement:true, |
||||
}, |
||||
|
||||
|
||||
char :{ |
||||
type: DataTypes.STRING, |
||||
}, |
||||
svgFile:{ |
||||
type: DataTypes.STRING, |
||||
|
||||
}, |
||||
varient:{ |
||||
type: DataTypes.STRING, |
||||
|
||||
}, |
||||
|
||||
name:{ |
||||
type: DataTypes.STRING, |
||||
|
||||
}, |
||||
|
||||
|
||||
description:{ |
||||
type: DataTypes.STRING, |
||||
|
||||
}, |
||||
|
||||
}); |
||||
// sequelize.sync({alter : true});
|
||||
|
||||
const relations = ()=>{ |
||||
|
||||
iconfont.belongsTo(font , {foreignKey: { name: 'iconfontID'} }); |
||||
font.hasMany(iconfont , {foreignKey: { name: 'iconfontID'}}); |
||||
} |
||||
|
||||
module.exports = {iconfont , font , relations} |
@ -0,0 +1,2 @@ |
||||
iconFont.belongsTo(font , {foreignKey: { name: 'iconfontID'} }); |
||||
font.hasMany(iconFont , {foreignKey: { name: 'iconfontID'}}); |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../atob/bin/atob.js" "$@" |
||||
else |
||||
exec node "$basedir/../atob/bin/atob.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\atob\bin\atob.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../atob/bin/atob.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../atob/bin/atob.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../atob/bin/atob.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../atob/bin/atob.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../color-support/bin.js" "$@" |
||||
else |
||||
exec node "$basedir/../color-support/bin.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\color-support\bin.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../color-support/bin.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../color-support/bin.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../color-support/bin.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../color-support/bin.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../colors-cli/bin/colors" "$@" |
||||
else |
||||
exec node "$basedir/../colors-cli/bin/colors" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\colors-cli\bin\colors" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../colors-cli/bin/colors" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../colors-cli/bin/colors" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../colors-cli/bin/colors" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../colors-cli/bin/colors" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../jake/bin/cli.js" "$@" |
||||
else |
||||
exec node "$basedir/../jake/bin/cli.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\jake\bin\cli.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../jake/bin/cli.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../jake/bin/cli.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../jake/bin/cli.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../jake/bin/cli.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../mime/cli.js" "$@" |
||||
else |
||||
exec node "$basedir/../mime/cli.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mime\cli.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../mime/cli.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../mime/cli.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../mime/cli.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../mime/cli.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@" |
||||
else |
||||
exec node "$basedir/../mkdirp/bin/cmd.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mkdirp\bin\cmd.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../node-gyp/bin/node-gyp.js" "$@" |
||||
else |
||||
exec node "$basedir/../node-gyp/bin/node-gyp.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\node-gyp\bin\node-gyp.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../node-gyp/bin/node-gyp.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../node-gyp/bin/node-gyp.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../node-gyp/bin/node-gyp.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../node-gyp/bin/node-gyp.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../which/bin/node-which" "$@" |
||||
else |
||||
exec node "$basedir/../which/bin/node-which" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\which\bin\node-which" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../which/bin/node-which" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../which/bin/node-which" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../which/bin/node-which" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../which/bin/node-which" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@" |
||||
else |
||||
exec node "$basedir/../nopt/bin/nopt.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nopt\bin\nopt.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../nopt/bin/nopt.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../nopt/bin/nopt.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../rimraf/bin.js" "$@" |
||||
else |
||||
exec node "$basedir/../rimraf/bin.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\rimraf\bin.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../rimraf/bin.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../rimraf/bin.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@" |
||||
else |
||||
exec node "$basedir/../semver/bin/semver.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../semver/bin/semver.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../semver/bin/semver.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../svg2ttf/svg2ttf.js" "$@" |
||||
else |
||||
exec node "$basedir/../svg2ttf/svg2ttf.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\svg2ttf\svg2ttf.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../svg2ttf/svg2ttf.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../svg2ttf/svg2ttf.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../svg2ttf/svg2ttf.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../svg2ttf/svg2ttf.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../svgicons2svgfont/bin/svgicons2svgfont.js" "$@" |
||||
else |
||||
exec node "$basedir/../svgicons2svgfont/bin/svgicons2svgfont.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\svgicons2svgfont\bin\svgicons2svgfont.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../svgicons2svgfont/bin/svgicons2svgfont.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../svgicons2svgfont/bin/svgicons2svgfont.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../svgicons2svgfont/bin/svgicons2svgfont.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../svgicons2svgfont/bin/svgicons2svgfont.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../svgo/bin/svgo" "$@" |
||||
else |
||||
exec node "$basedir/../svgo/bin/svgo" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\svgo\bin\svgo" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../svgo/bin/svgo" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../svgo/bin/svgo" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../svgo/bin/svgo" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../svgo/bin/svgo" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../svgtofont/lib/cli.js" "$@" |
||||
else |
||||
exec node "$basedir/../svgtofont/lib/cli.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\svgtofont\lib\cli.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../svgtofont/lib/cli.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../svgtofont/lib/cli.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../svgtofont/lib/cli.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../svgtofont/lib/cli.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../ttf2eot/ttf2eot.js" "$@" |
||||
else |
||||
exec node "$basedir/../ttf2eot/ttf2eot.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\ttf2eot\ttf2eot.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../ttf2eot/ttf2eot.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../ttf2eot/ttf2eot.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../ttf2eot/ttf2eot.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../ttf2eot/ttf2eot.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../ttf2woff/ttf2woff.js" "$@" |
||||
else |
||||
exec node "$basedir/../ttf2woff/ttf2woff.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\ttf2woff\ttf2woff.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../ttf2woff/ttf2woff.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../ttf2woff/ttf2woff.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../ttf2woff/ttf2woff.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../ttf2woff/ttf2woff.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../ttf2woff2/bin/ttf2woff2.js" "$@" |
||||
else |
||||
exec node "$basedir/../ttf2woff2/bin/ttf2woff2.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\ttf2woff2\bin\ttf2woff2.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../ttf2woff2/bin/ttf2woff2.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../ttf2woff2/bin/ttf2woff2.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../ttf2woff2/bin/ttf2woff2.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../ttf2woff2/bin/ttf2woff2.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,10 @@ |
||||
The MIT License (MIT) |
||||
|
||||
Copyright © 2020-2022 Michael Garvin |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||||
|
@ -0,0 +1,65 @@ |
||||
# @gar/promisify |
||||
|
||||
### Promisify an entire object or class instance |
||||
|
||||
This module leverages es6 Proxy and Reflect to promisify every function in an |
||||
object or class instance. |
||||
|
||||
It assumes the callback that the function is expecting is the last |
||||
parameter, and that it is an error-first callback with only one value, |
||||
i.e. `(err, value) => ...`. This mirrors node's `util.promisify` method. |
||||
|
||||
In order that you can use it as a one-stop-shop for all your promisify |
||||
needs, you can also pass it a function. That function will be |
||||
promisified as normal using node's built-in `util.promisify` method. |
||||
|
||||
[node's custom promisified |
||||
functions](https://nodejs.org/api/util.html#util_custom_promisified_functions) |
||||
will also be mirrored, further allowing this to be a drop-in replacement |
||||
for the built-in `util.promisify`. |
||||
|
||||
### Examples |
||||
|
||||
Promisify an entire object |
||||
|
||||
```javascript |
||||
|
||||
const promisify = require('@gar/promisify') |
||||
|
||||
class Foo { |
||||
constructor (attr) { |
||||
this.attr = attr |
||||
} |
||||
|
||||
double (input, cb) { |
||||
cb(null, input * 2) |
||||
} |
||||
|
||||
const foo = new Foo('baz') |
||||
const promisified = promisify(foo) |
||||
|
||||
console.log(promisified.attr) |
||||
console.log(await promisified.double(1024)) |
||||
``` |
||||
|
||||
Promisify a function |
||||
|
||||
```javascript |
||||
|
||||
const promisify = require('@gar/promisify') |
||||
|
||||
function foo (a, cb) { |
||||
if (a !== 'bad') { |
||||
return cb(null, 'ok') |
||||
} |
||||
return cb('not ok') |
||||
} |
||||
|
||||
const promisified = promisify(foo) |
||||
|
||||
// This will resolve to 'ok' |
||||
promisified('good') |
||||
|
||||
// this will reject |
||||
promisified('bad') |
||||
``` |
@ -0,0 +1,36 @@ |
||||
'use strict' |
||||
|
||||
const { promisify } = require('util') |
||||
|
||||
const handler = { |
||||
get: function (target, prop, receiver) { |
||||
if (typeof target[prop] !== 'function') { |
||||
return target[prop] |
||||
} |
||||
if (target[prop][promisify.custom]) { |
||||
return function () { |
||||
return Reflect.get(target, prop, receiver)[promisify.custom].apply(target, arguments) |
||||
} |
||||
} |
||||
return function () { |
||||
return new Promise((resolve, reject) => { |
||||
Reflect.get(target, prop, receiver).apply(target, [...arguments, function (err, result) { |
||||
if (err) { |
||||
return reject(err) |
||||
} |
||||
resolve(result) |
||||
}]) |
||||
}) |
||||
} |
||||
} |
||||
} |
||||
|
||||
module.exports = function (thingToPromisify) { |
||||
if (typeof thingToPromisify === 'function') { |
||||
return promisify(thingToPromisify) |
||||
} |
||||
if (typeof thingToPromisify === 'object') { |
||||
return new Proxy(thingToPromisify, handler) |
||||
} |
||||
throw new TypeError('Can only promisify functions or objects') |
||||
} |
@ -0,0 +1,32 @@ |
||||
{ |
||||
"name": "@gar/promisify", |
||||
"version": "1.1.3", |
||||
"description": "Promisify an entire class or object", |
||||
"main": "index.js", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "https://github.com/wraithgar/gar-promisify.git" |
||||
}, |
||||
"scripts": { |
||||
"lint": "standard", |
||||
"lint:fix": "standard --fix", |
||||
"test": "lab -a @hapi/code -t 100", |
||||
"posttest": "npm run lint" |
||||
}, |
||||
"files": [ |
||||
"index.js" |
||||
], |
||||
"keywords": [ |
||||
"promisify", |
||||
"all", |
||||
"class", |
||||
"object" |
||||
], |
||||
"author": "Gar <gar+npm@danger.computer>", |
||||
"license": "MIT", |
||||
"devDependencies": { |
||||
"@hapi/code": "^8.0.1", |
||||
"@hapi/lab": "^24.1.0", |
||||
"standard": "^16.0.3" |
||||
} |
||||
} |
@ -0,0 +1,21 @@ |
||||
The MIT License (MIT) |
||||
|
||||
Copyright (c) Denis Malinochkin |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
SOFTWARE. |
@ -0,0 +1,171 @@ |
||||
# @nodelib/fs.scandir |
||||
|
||||
> List files and directories inside the specified directory. |
||||
|
||||
## :bulb: Highlights |
||||
|
||||
The package is aimed at obtaining information about entries in the directory. |
||||
|
||||
* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional). |
||||
* :gear: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type. See [`old` and `modern` mode](#old-and-modern-mode). |
||||
* :link: Can safely work with broken symbolic links. |
||||
|
||||
## Install |
||||
|
||||
```console |
||||
npm install @nodelib/fs.scandir |
||||
``` |
||||
|
||||
## Usage |
||||
|
||||
```ts |
||||
import * as fsScandir from '@nodelib/fs.scandir'; |
||||
|
||||
fsScandir.scandir('path', (error, stats) => { /* … */ }); |
||||
``` |
||||
|
||||
## API |
||||
|
||||
### .scandir(path, [optionsOrSettings], callback) |
||||
|
||||
Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path with standard callback-style. |
||||
|
||||
```ts |
||||
fsScandir.scandir('path', (error, entries) => { /* … */ }); |
||||
fsScandir.scandir('path', {}, (error, entries) => { /* … */ }); |
||||
fsScandir.scandir('path', new fsScandir.Settings(), (error, entries) => { /* … */ }); |
||||
``` |
||||
|
||||
### .scandirSync(path, [optionsOrSettings]) |
||||
|
||||
Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path. |
||||
|
||||
```ts |
||||
const entries = fsScandir.scandirSync('path'); |
||||
const entries = fsScandir.scandirSync('path', {}); |
||||
const entries = fsScandir.scandirSync(('path', new fsScandir.Settings()); |
||||
``` |
||||
|
||||
#### path |
||||
|
||||
* Required: `true` |
||||
* Type: `string | Buffer | URL` |
||||
|
||||
A path to a file. If a URL is provided, it must use the `file:` protocol. |
||||
|
||||
#### optionsOrSettings |
||||
|
||||
* Required: `false` |
||||
* Type: `Options | Settings` |
||||
* Default: An instance of `Settings` class |
||||
|
||||
An [`Options`](#options) object or an instance of [`Settings`](#settingsoptions) class. |
||||
|
||||
> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class. |
||||
|
||||
### Settings([options]) |
||||
|
||||
A class of full settings of the package. |
||||
|
||||
```ts |
||||
const settings = new fsScandir.Settings({ followSymbolicLinks: false }); |
||||
|
||||
const entries = fsScandir.scandirSync('path', settings); |
||||
``` |
||||
|
||||
## Entry |
||||
|
||||
* `name` — The name of the entry (`unknown.txt`). |
||||
* `path` — The path of the entry relative to call directory (`root/unknown.txt`). |
||||
* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class. On Node.js below 10.10 will be emulated by [`DirentFromStats`](./src/utils/fs.ts) class. |
||||
* `stats` (optional) — An instance of `fs.Stats` class. |
||||
|
||||
For example, the `scandir` call for `tools` directory with one directory inside: |
||||
|
||||
```ts |
||||
{ |
||||
dirent: Dirent { name: 'typedoc', /* … */ }, |
||||
name: 'typedoc', |
||||
path: 'tools/typedoc' |
||||
} |
||||
``` |
||||
|
||||
## Options |
||||
|
||||
### stats |
||||
|
||||
* Type: `boolean` |
||||
* Default: `false` |
||||
|
||||
Adds an instance of `fs.Stats` class to the [`Entry`](#entry). |
||||
|
||||
> :book: Always use `fs.readdir` without the `withFileTypes` option. ??TODO?? |
||||
|
||||
### followSymbolicLinks |
||||
|
||||
* Type: `boolean` |
||||
* Default: `false` |
||||
|
||||
Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`. |
||||
|
||||
### `throwErrorOnBrokenSymbolicLink` |
||||
|
||||
* Type: `boolean` |
||||
* Default: `true` |
||||
|
||||
Throw an error when symbolic link is broken if `true` or safely use `lstat` call if `false`. |
||||
|
||||
### `pathSegmentSeparator` |
||||
|
||||
* Type: `string` |
||||
* Default: `path.sep` |
||||
|
||||
By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead. |
||||
|
||||
### `fs` |
||||
|
||||
* Type: [`FileSystemAdapter`](./src/adapters/fs.ts) |
||||
* Default: A default FS methods |
||||
|
||||
By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own. |
||||
|
||||
```ts |
||||
interface FileSystemAdapter { |
||||
lstat?: typeof fs.lstat; |
||||
stat?: typeof fs.stat; |
||||
lstatSync?: typeof fs.lstatSync; |
||||
statSync?: typeof fs.statSync; |
||||
readdir?: typeof fs.readdir; |
||||
readdirSync?: typeof fs.readdirSync; |
||||
} |
||||
|
||||
const settings = new fsScandir.Settings({ |
||||
fs: { lstat: fakeLstat } |
||||
}); |
||||
``` |
||||
|
||||
## `old` and `modern` mode |
||||
|
||||
This package has two modes that are used depending on the environment and parameters of use. |
||||
|
||||
### old |
||||
|
||||
* Node.js below `10.10` or when the `stats` option is enabled |
||||
|
||||
When working in the old mode, the directory is read first (`fs.readdir`), then the type of entries is determined (`fs.lstat` and/or `fs.stat` for symbolic links). |
||||
|
||||
### modern |
||||
|
||||
* Node.js 10.10+ and the `stats` option is disabled |
||||
|
||||
In the modern mode, reading the directory (`fs.readdir` with the `withFileTypes` option) is combined with obtaining information about its entries. An additional call for symbolic links (`fs.stat`) is still present. |
||||
|
||||
This mode makes fewer calls to the file system. It's faster. |
||||
|
||||
## Changelog |
||||
|
||||
See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version. |
||||
|
||||
## License |
||||
|
||||
This software is released under the terms of the MIT license. |
@ -0,0 +1,20 @@ |
||||
import type * as fsStat from '@nodelib/fs.stat'; |
||||
import type { Dirent, ErrnoException } from '../types'; |
||||
export interface ReaddirAsynchronousMethod { |
||||
(filepath: string, options: { |
||||
withFileTypes: true; |
||||
}, callback: (error: ErrnoException | null, files: Dirent[]) => void): void; |
||||
(filepath: string, callback: (error: ErrnoException | null, files: string[]) => void): void; |
||||
} |
||||
export interface ReaddirSynchronousMethod { |
||||
(filepath: string, options: { |
||||
withFileTypes: true; |
||||
}): Dirent[]; |
||||
(filepath: string): string[]; |
||||
} |
||||
export declare type FileSystemAdapter = fsStat.FileSystemAdapter & { |
||||
readdir: ReaddirAsynchronousMethod; |
||||
readdirSync: ReaddirSynchronousMethod; |
||||
}; |
||||
export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter; |
||||
export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter; |
@ -0,0 +1,19 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; |
||||
const fs = require("fs"); |
||||
exports.FILE_SYSTEM_ADAPTER = { |
||||
lstat: fs.lstat, |
||||
stat: fs.stat, |
||||
lstatSync: fs.lstatSync, |
||||
statSync: fs.statSync, |
||||
readdir: fs.readdir, |
||||
readdirSync: fs.readdirSync |
||||
}; |
||||
function createFileSystemAdapter(fsMethods) { |
||||
if (fsMethods === undefined) { |
||||
return exports.FILE_SYSTEM_ADAPTER; |
||||
} |
||||
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); |
||||
} |
||||
exports.createFileSystemAdapter = createFileSystemAdapter; |
@ -0,0 +1,4 @@ |
||||
/** |
||||
* IS `true` for Node.js 10.10 and greater. |
||||
*/ |
||||
export declare const IS_SUPPORT_READDIR_WITH_FILE_TYPES: boolean; |
@ -0,0 +1,17 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0; |
||||
const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.'); |
||||
if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) { |
||||
throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`); |
||||
} |
||||
const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); |
||||
const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); |
||||
const SUPPORTED_MAJOR_VERSION = 10; |
||||
const SUPPORTED_MINOR_VERSION = 10; |
||||
const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; |
||||
const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; |
||||
/** |
||||
* IS `true` for Node.js 10.10 and greater. |
||||
*/ |
||||
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; |
@ -0,0 +1,12 @@ |
||||
import type { FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod } from './adapters/fs'; |
||||
import * as async from './providers/async'; |
||||
import Settings, { Options } from './settings'; |
||||
import type { Dirent, Entry } from './types'; |
||||
declare type AsyncCallback = async.AsyncCallback; |
||||
declare function scandir(path: string, callback: AsyncCallback): void; |
||||
declare function scandir(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; |
||||
declare namespace scandir { |
||||
function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Entry[]>; |
||||
} |
||||
declare function scandirSync(path: string, optionsOrSettings?: Options | Settings): Entry[]; |
||||
export { scandir, scandirSync, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod, Options }; |
@ -0,0 +1,26 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.Settings = exports.scandirSync = exports.scandir = void 0; |
||||
const async = require("./providers/async"); |
||||
const sync = require("./providers/sync"); |
||||
const settings_1 = require("./settings"); |
||||
exports.Settings = settings_1.default; |
||||
function scandir(path, optionsOrSettingsOrCallback, callback) { |
||||
if (typeof optionsOrSettingsOrCallback === 'function') { |
||||
async.read(path, getSettings(), optionsOrSettingsOrCallback); |
||||
return; |
||||
} |
||||
async.read(path, getSettings(optionsOrSettingsOrCallback), callback); |
||||
} |
||||
exports.scandir = scandir; |
||||
function scandirSync(path, optionsOrSettings) { |
||||
const settings = getSettings(optionsOrSettings); |
||||
return sync.read(path, settings); |
||||
} |
||||
exports.scandirSync = scandirSync; |
||||
function getSettings(settingsOrOptions = {}) { |
||||
if (settingsOrOptions instanceof settings_1.default) { |
||||
return settingsOrOptions; |
||||
} |
||||
return new settings_1.default(settingsOrOptions); |
||||
} |
@ -0,0 +1,7 @@ |
||||
/// <reference types="node" />
|
||||
import type Settings from '../settings'; |
||||
import type { Entry } from '../types'; |
||||
export declare type AsyncCallback = (error: NodeJS.ErrnoException, entries: Entry[]) => void; |
||||
export declare function read(directory: string, settings: Settings, callback: AsyncCallback): void; |
||||
export declare function readdirWithFileTypes(directory: string, settings: Settings, callback: AsyncCallback): void; |
||||
export declare function readdir(directory: string, settings: Settings, callback: AsyncCallback): void; |
@ -0,0 +1,104 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; |
||||
const fsStat = require("@nodelib/fs.stat"); |
||||
const rpl = require("run-parallel"); |
||||
const constants_1 = require("../constants"); |
||||
const utils = require("../utils"); |
||||
const common = require("./common"); |
||||
function read(directory, settings, callback) { |
||||
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { |
||||
readdirWithFileTypes(directory, settings, callback); |
||||
return; |
||||
} |
||||
readdir(directory, settings, callback); |
||||
} |
||||
exports.read = read; |
||||
function readdirWithFileTypes(directory, settings, callback) { |
||||
settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => { |
||||
if (readdirError !== null) { |
||||
callFailureCallback(callback, readdirError); |
||||
return; |
||||
} |
||||
const entries = dirents.map((dirent) => ({ |
||||
dirent, |
||||
name: dirent.name, |
||||
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) |
||||
})); |
||||
if (!settings.followSymbolicLinks) { |
||||
callSuccessCallback(callback, entries); |
||||
return; |
||||
} |
||||
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings)); |
||||
rpl(tasks, (rplError, rplEntries) => { |
||||
if (rplError !== null) { |
||||
callFailureCallback(callback, rplError); |
||||
return; |
||||
} |
||||
callSuccessCallback(callback, rplEntries); |
||||
}); |
||||
}); |
||||
} |
||||
exports.readdirWithFileTypes = readdirWithFileTypes; |
||||
function makeRplTaskEntry(entry, settings) { |
||||
return (done) => { |
||||
if (!entry.dirent.isSymbolicLink()) { |
||||
done(null, entry); |
||||
return; |
||||
} |
||||
settings.fs.stat(entry.path, (statError, stats) => { |
||||
if (statError !== null) { |
||||
if (settings.throwErrorOnBrokenSymbolicLink) { |
||||
done(statError); |
||||
return; |
||||
} |
||||
done(null, entry); |
||||
return; |
||||
} |
||||
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); |
||||
done(null, entry); |
||||
}); |
||||
}; |
||||
} |
||||
function readdir(directory, settings, callback) { |
||||
settings.fs.readdir(directory, (readdirError, names) => { |
||||
if (readdirError !== null) { |
||||
callFailureCallback(callback, readdirError); |
||||
return; |
||||
} |
||||
const tasks = names.map((name) => { |
||||
const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); |
||||
return (done) => { |
||||
fsStat.stat(path, settings.fsStatSettings, (error, stats) => { |
||||
if (error !== null) { |
||||
done(error); |
||||
return; |
||||
} |
||||
const entry = { |
||||
name, |
||||
path, |
||||
dirent: utils.fs.createDirentFromStats(name, stats) |
||||
}; |
||||
if (settings.stats) { |
||||
entry.stats = stats; |
||||
} |
||||
done(null, entry); |
||||
}); |
||||
}; |
||||
}); |
||||
rpl(tasks, (rplError, entries) => { |
||||
if (rplError !== null) { |
||||
callFailureCallback(callback, rplError); |
||||
return; |
||||
} |
||||
callSuccessCallback(callback, entries); |
||||
}); |
||||
}); |
||||
} |
||||
exports.readdir = readdir; |
||||
function callFailureCallback(callback, error) { |
||||
callback(error); |
||||
} |
||||
function callSuccessCallback(callback, result) { |
||||
callback(null, result); |
||||
} |
@ -0,0 +1 @@ |
||||
export declare function joinPathSegments(a: string, b: string, separator: string): string; |
@ -0,0 +1,13 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.joinPathSegments = void 0; |
||||
function joinPathSegments(a, b, separator) { |
||||
/** |
||||
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). |
||||
*/ |
||||
if (a.endsWith(separator)) { |
||||
return a + b; |
||||
} |
||||
return a + separator + b; |
||||
} |
||||
exports.joinPathSegments = joinPathSegments; |
@ -0,0 +1,5 @@ |
||||
import type Settings from '../settings'; |
||||
import type { Entry } from '../types'; |
||||
export declare function read(directory: string, settings: Settings): Entry[]; |
||||
export declare function readdirWithFileTypes(directory: string, settings: Settings): Entry[]; |
||||
export declare function readdir(directory: string, settings: Settings): Entry[]; |
@ -0,0 +1,54 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; |
||||
const fsStat = require("@nodelib/fs.stat"); |
||||
const constants_1 = require("../constants"); |
||||
const utils = require("../utils"); |
||||
const common = require("./common"); |
||||
function read(directory, settings) { |
||||
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { |
||||
return readdirWithFileTypes(directory, settings); |
||||
} |
||||
return readdir(directory, settings); |
||||
} |
||||
exports.read = read; |
||||
function readdirWithFileTypes(directory, settings) { |
||||
const dirents = settings.fs.readdirSync(directory, { withFileTypes: true }); |
||||
return dirents.map((dirent) => { |
||||
const entry = { |
||||
dirent, |
||||
name: dirent.name, |
||||
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) |
||||
}; |
||||
if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) { |
||||
try { |
||||
const stats = settings.fs.statSync(entry.path); |
||||
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); |
||||
} |
||||
catch (error) { |
||||
if (settings.throwErrorOnBrokenSymbolicLink) { |
||||
throw error; |
||||
} |
||||
} |
||||
} |
||||
return entry; |
||||
}); |
||||
} |
||||
exports.readdirWithFileTypes = readdirWithFileTypes; |
||||
function readdir(directory, settings) { |
||||
const names = settings.fs.readdirSync(directory); |
||||
return names.map((name) => { |
||||
const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); |
||||
const stats = fsStat.statSync(entryPath, settings.fsStatSettings); |
||||
const entry = { |
||||
name, |
||||
path: entryPath, |
||||
dirent: utils.fs.createDirentFromStats(name, stats) |
||||
}; |
||||
if (settings.stats) { |
||||
entry.stats = stats; |
||||
} |
||||
return entry; |
||||
}); |
||||
} |
||||
exports.readdir = readdir; |
@ -0,0 +1,20 @@ |
||||
import * as fsStat from '@nodelib/fs.stat'; |
||||
import * as fs from './adapters/fs'; |
||||
export interface Options { |
||||
followSymbolicLinks?: boolean; |
||||
fs?: Partial<fs.FileSystemAdapter>; |
||||
pathSegmentSeparator?: string; |
||||
stats?: boolean; |
||||
throwErrorOnBrokenSymbolicLink?: boolean; |
||||
} |
||||
export default class Settings { |
||||
private readonly _options; |
||||
readonly followSymbolicLinks: boolean; |
||||
readonly fs: fs.FileSystemAdapter; |
||||
readonly pathSegmentSeparator: string; |
||||
readonly stats: boolean; |
||||
readonly throwErrorOnBrokenSymbolicLink: boolean; |
||||
readonly fsStatSettings: fsStat.Settings; |
||||
constructor(_options?: Options); |
||||
private _getValue; |
||||
} |
@ -0,0 +1,24 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
const path = require("path"); |
||||
const fsStat = require("@nodelib/fs.stat"); |
||||
const fs = require("./adapters/fs"); |
||||
class Settings { |
||||
constructor(_options = {}) { |
||||
this._options = _options; |
||||
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); |
||||
this.fs = fs.createFileSystemAdapter(this._options.fs); |
||||
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); |
||||
this.stats = this._getValue(this._options.stats, false); |
||||
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); |
||||
this.fsStatSettings = new fsStat.Settings({ |
||||
followSymbolicLink: this.followSymbolicLinks, |
||||
fs: this.fs, |
||||
throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink |
||||
}); |
||||
} |
||||
_getValue(option, value) { |
||||
return option !== null && option !== void 0 ? option : value; |
||||
} |
||||
} |
||||
exports.default = Settings; |
@ -0,0 +1,20 @@ |
||||
/// <reference types="node" />
|
||||
import type * as fs from 'fs'; |
||||
export interface Entry { |
||||
dirent: Dirent; |
||||
name: string; |
||||
path: string; |
||||
stats?: Stats; |
||||
} |
||||
export declare type Stats = fs.Stats; |
||||
export declare type ErrnoException = NodeJS.ErrnoException; |
||||
export interface Dirent { |
||||
isBlockDevice: () => boolean; |
||||
isCharacterDevice: () => boolean; |
||||
isDirectory: () => boolean; |
||||
isFIFO: () => boolean; |
||||
isFile: () => boolean; |
||||
isSocket: () => boolean; |
||||
isSymbolicLink: () => boolean; |
||||
name: string; |
||||
} |
@ -0,0 +1,2 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
@ -0,0 +1,2 @@ |
||||
import type { Dirent, Stats } from '../types'; |
||||
export declare function createDirentFromStats(name: string, stats: Stats): Dirent; |
@ -0,0 +1,19 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.createDirentFromStats = void 0; |
||||
class DirentFromStats { |
||||
constructor(name, stats) { |
||||
this.name = name; |
||||
this.isBlockDevice = stats.isBlockDevice.bind(stats); |
||||
this.isCharacterDevice = stats.isCharacterDevice.bind(stats); |
||||
this.isDirectory = stats.isDirectory.bind(stats); |
||||
this.isFIFO = stats.isFIFO.bind(stats); |
||||
this.isFile = stats.isFile.bind(stats); |
||||
this.isSocket = stats.isSocket.bind(stats); |
||||
this.isSymbolicLink = stats.isSymbolicLink.bind(stats); |
||||
} |
||||
} |
||||
function createDirentFromStats(name, stats) { |
||||
return new DirentFromStats(name, stats); |
||||
} |
||||
exports.createDirentFromStats = createDirentFromStats; |
@ -0,0 +1,2 @@ |
||||
import * as fs from './fs'; |
||||
export { fs }; |
@ -0,0 +1,5 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.fs = void 0; |
||||
const fs = require("./fs"); |
||||
exports.fs = fs; |
@ -0,0 +1,44 @@ |
||||
{ |
||||
"name": "@nodelib/fs.scandir", |
||||
"version": "2.1.5", |
||||
"description": "List files and directories inside the specified directory", |
||||
"license": "MIT", |
||||
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir", |
||||
"keywords": [ |
||||
"NodeLib", |
||||
"fs", |
||||
"FileSystem", |
||||
"file system", |
||||
"scandir", |
||||
"readdir", |
||||
"dirent" |
||||
], |
||||
"engines": { |
||||
"node": ">= 8" |
||||
}, |
||||
"files": [ |
||||
"out/**", |
||||
"!out/**/*.map", |
||||
"!out/**/*.spec.*" |
||||
], |
||||
"main": "out/index.js", |
||||
"typings": "out/index.d.ts", |
||||
"scripts": { |
||||
"clean": "rimraf {tsconfig.tsbuildinfo,out}", |
||||
"lint": "eslint \"src/**/*.ts\" --cache", |
||||
"compile": "tsc -b .", |
||||
"compile:watch": "tsc -p . --watch --sourceMap", |
||||
"test": "mocha \"out/**/*.spec.js\" -s 0", |
||||
"build": "npm run clean && npm run compile && npm run lint && npm test", |
||||
"watch": "npm run clean && npm run compile:watch" |
||||
}, |
||||
"dependencies": { |
||||
"@nodelib/fs.stat": "2.0.5", |
||||
"run-parallel": "^1.1.9" |
||||
}, |
||||
"devDependencies": { |
||||
"@nodelib/fs.macchiato": "1.0.4", |
||||
"@types/run-parallel": "^1.1.0" |
||||
}, |
||||
"gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562" |
||||
} |
@ -0,0 +1,21 @@ |
||||
The MIT License (MIT) |
||||
|
||||
Copyright (c) Denis Malinochkin |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
SOFTWARE. |
@ -0,0 +1,126 @@ |
||||
# @nodelib/fs.stat |
||||
|
||||
> Get the status of a file with some features. |
||||
|
||||
## :bulb: Highlights |
||||
|
||||
Wrapper around standard method `fs.lstat` and `fs.stat` with some features. |
||||
|
||||
* :beginner: Normally follows symbolic link. |
||||
* :gear: Can safely work with broken symbolic link. |
||||
|
||||
## Install |
||||
|
||||
```console |
||||
npm install @nodelib/fs.stat |
||||
``` |
||||
|
||||
## Usage |
||||
|
||||
```ts |
||||
import * as fsStat from '@nodelib/fs.stat'; |
||||
|
||||
fsStat.stat('path', (error, stats) => { /* … */ }); |
||||
``` |
||||
|
||||
## API |
||||
|
||||
### .stat(path, [optionsOrSettings], callback) |
||||
|
||||
Returns an instance of `fs.Stats` class for provided path with standard callback-style. |
||||
|
||||
```ts |
||||
fsStat.stat('path', (error, stats) => { /* … */ }); |
||||
fsStat.stat('path', {}, (error, stats) => { /* … */ }); |
||||
fsStat.stat('path', new fsStat.Settings(), (error, stats) => { /* … */ }); |
||||
``` |
||||
|
||||
### .statSync(path, [optionsOrSettings]) |
||||
|
||||
Returns an instance of `fs.Stats` class for provided path. |
||||
|
||||
```ts |
||||
const stats = fsStat.stat('path'); |
||||
const stats = fsStat.stat('path', {}); |
||||
const stats = fsStat.stat('path', new fsStat.Settings()); |
||||
``` |
||||
|
||||
#### path |
||||
|
||||
* Required: `true` |
||||
* Type: `string | Buffer | URL` |
||||
|
||||
A path to a file. If a URL is provided, it must use the `file:` protocol. |
||||
|
||||
#### optionsOrSettings |
||||
|
||||
* Required: `false` |
||||
* Type: `Options | Settings` |
||||
* Default: An instance of `Settings` class |
||||
|
||||
An [`Options`](#options) object or an instance of [`Settings`](#settings) class. |
||||
|
||||
> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class. |
||||
|
||||
### Settings([options]) |
||||
|
||||
A class of full settings of the package. |
||||
|
||||
```ts |
||||
const settings = new fsStat.Settings({ followSymbolicLink: false }); |
||||
|
||||
const stats = fsStat.stat('path', settings); |
||||
``` |
||||
|
||||
## Options |
||||
|
||||
### `followSymbolicLink` |
||||
|
||||
* Type: `boolean` |
||||
* Default: `true` |
||||
|
||||
Follow symbolic link or not. Call `fs.stat` on symbolic link if `true`. |
||||
|
||||
### `markSymbolicLink` |
||||
|
||||
* Type: `boolean` |
||||
* Default: `false` |
||||
|
||||
Mark symbolic link by setting the return value of `isSymbolicLink` function to always `true` (even after `fs.stat`). |
||||
|
||||
> :book: Can be used if you want to know what is hidden behind a symbolic link, but still continue to know that it is a symbolic link. |
||||
|
||||
### `throwErrorOnBrokenSymbolicLink` |
||||
|
||||
* Type: `boolean` |
||||
* Default: `true` |
||||
|
||||
Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`. |
||||
|
||||
### `fs` |
||||
|
||||
* Type: [`FileSystemAdapter`](./src/adapters/fs.ts) |
||||
* Default: A default FS methods |
||||
|
||||
By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own. |
||||
|
||||
```ts |
||||
interface FileSystemAdapter { |
||||
lstat?: typeof fs.lstat; |
||||
stat?: typeof fs.stat; |
||||
lstatSync?: typeof fs.lstatSync; |
||||
statSync?: typeof fs.statSync; |
||||
} |
||||
|
||||
const settings = new fsStat.Settings({ |
||||
fs: { lstat: fakeLstat } |
||||
}); |
||||
``` |
||||
|
||||
## Changelog |
||||
|
||||
See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version. |
||||
|
||||
## License |
||||
|
||||
This software is released under the terms of the MIT license. |
@ -0,0 +1,13 @@ |
||||
/// <reference types="node" />
|
||||
import * as fs from 'fs'; |
||||
import type { ErrnoException } from '../types'; |
||||
export declare type StatAsynchronousMethod = (path: string, callback: (error: ErrnoException | null, stats: fs.Stats) => void) => void; |
||||
export declare type StatSynchronousMethod = (path: string) => fs.Stats; |
||||
export interface FileSystemAdapter { |
||||
lstat: StatAsynchronousMethod; |
||||
stat: StatAsynchronousMethod; |
||||
lstatSync: StatSynchronousMethod; |
||||
statSync: StatSynchronousMethod; |
||||
} |
||||
export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter; |
||||
export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter; |
@ -0,0 +1,17 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; |
||||
const fs = require("fs"); |
||||
exports.FILE_SYSTEM_ADAPTER = { |
||||
lstat: fs.lstat, |
||||
stat: fs.stat, |
||||
lstatSync: fs.lstatSync, |
||||
statSync: fs.statSync |
||||
}; |
||||
function createFileSystemAdapter(fsMethods) { |
||||
if (fsMethods === undefined) { |
||||
return exports.FILE_SYSTEM_ADAPTER; |
||||
} |
||||
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); |
||||
} |
||||
exports.createFileSystemAdapter = createFileSystemAdapter; |
@ -0,0 +1,12 @@ |
||||
import type { FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod } from './adapters/fs'; |
||||
import * as async from './providers/async'; |
||||
import Settings, { Options } from './settings'; |
||||
import type { Stats } from './types'; |
||||
declare type AsyncCallback = async.AsyncCallback; |
||||
declare function stat(path: string, callback: AsyncCallback): void; |
||||
declare function stat(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; |
||||
declare namespace stat { |
||||
function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Stats>; |
||||
} |
||||
declare function statSync(path: string, optionsOrSettings?: Options | Settings): Stats; |
||||
export { Settings, stat, statSync, AsyncCallback, FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod, Options, Stats }; |
@ -0,0 +1,26 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.statSync = exports.stat = exports.Settings = void 0; |
||||
const async = require("./providers/async"); |
||||
const sync = require("./providers/sync"); |
||||
const settings_1 = require("./settings"); |
||||
exports.Settings = settings_1.default; |
||||
function stat(path, optionsOrSettingsOrCallback, callback) { |
||||
if (typeof optionsOrSettingsOrCallback === 'function') { |
||||
async.read(path, getSettings(), optionsOrSettingsOrCallback); |
||||
return; |
||||
} |
||||
async.read(path, getSettings(optionsOrSettingsOrCallback), callback); |
||||
} |
||||
exports.stat = stat; |
||||
function statSync(path, optionsOrSettings) { |
||||
const settings = getSettings(optionsOrSettings); |
||||
return sync.read(path, settings); |
||||
} |
||||
exports.statSync = statSync; |
||||
function getSettings(settingsOrOptions = {}) { |
||||
if (settingsOrOptions instanceof settings_1.default) { |
||||
return settingsOrOptions; |
||||
} |
||||
return new settings_1.default(settingsOrOptions); |
||||
} |
@ -0,0 +1,4 @@ |
||||
import type Settings from '../settings'; |
||||
import type { ErrnoException, Stats } from '../types'; |
||||
export declare type AsyncCallback = (error: ErrnoException, stats: Stats) => void; |
||||
export declare function read(path: string, settings: Settings, callback: AsyncCallback): void; |
@ -0,0 +1,36 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.read = void 0; |
||||
function read(path, settings, callback) { |
||||
settings.fs.lstat(path, (lstatError, lstat) => { |
||||
if (lstatError !== null) { |
||||
callFailureCallback(callback, lstatError); |
||||
return; |
||||
} |
||||
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { |
||||
callSuccessCallback(callback, lstat); |
||||
return; |
||||
} |
||||
settings.fs.stat(path, (statError, stat) => { |
||||
if (statError !== null) { |
||||
if (settings.throwErrorOnBrokenSymbolicLink) { |
||||
callFailureCallback(callback, statError); |
||||
return; |
||||
} |
||||
callSuccessCallback(callback, lstat); |
||||
return; |
||||
} |
||||
if (settings.markSymbolicLink) { |
||||
stat.isSymbolicLink = () => true; |
||||
} |
||||
callSuccessCallback(callback, stat); |
||||
}); |
||||
}); |
||||
} |
||||
exports.read = read; |
||||
function callFailureCallback(callback, error) { |
||||
callback(error); |
||||
} |
||||
function callSuccessCallback(callback, result) { |
||||
callback(null, result); |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue