time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

index.js (1606B)


      1 /**
      2 * @license Apache-2.0
      3 *
      4 * Copyright (c) 2018 The Stdlib Authors.
      5 *
      6 * Licensed under the Apache License, Version 2.0 (the "License");
      7 * you may not use this file except in compliance with the License.
      8 * You may obtain a copy of the License at
      9 *
     10 *    http://www.apache.org/licenses/LICENSE-2.0
     11 *
     12 * Unless required by applicable law or agreed to in writing, software
     13 * distributed under the License is distributed on an "AS IS" BASIS,
     14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15 * See the License for the specific language governing permissions and
     16 * limitations under the License.
     17 */
     18 
     19 'use strict';
     20 
     21 /**
     22 * Test whether a path exists on the filesystem. For more information, see the [archive][1].
     23 *
     24 * [1]: https://github.com/nodejs/node-v0.x-archive/blob/d8baf8a2a4481940bfed0196308ae6189ca18eee/lib/fs.js#L222
     25 *
     26 * @module @stdlib/fs/exists
     27 *
     28 * @example
     29 * var exists = require( '@stdlib/fs/exists' );
     30 *
     31 * exists( __dirname, done );
     32 * exists( 'beepboop', done );
     33 *
     34 * function done( error, bool ) {
     35 *     if ( error ) {
     36 *         console.error( error.message );
     37 *     } else {
     38 *         console.log( bool );
     39 *     }
     40 * }
     41 *
     42 * @example
     43 * var existsSync = require( '@stdlib/fs/exists' ).sync;
     44 *
     45 * console.log( existsSync( __dirname ) );
     46 * // => true
     47 *
     48 * console.log( existsSync( 'beepboop' ) );
     49 * // => false
     50 */
     51 
     52 // MODULES //
     53 
     54 var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
     55 var exists = require( './async.js' );
     56 var sync = require( './sync.js' );
     57 
     58 
     59 // MAIN //
     60 
     61 setReadOnly( exists, 'sync', sync );
     62 
     63 
     64 // EXPORTS //
     65 
     66 module.exports = exists;