Giter Site home page Giter Site logo

url-exist-sync's Introduction

URL Exists Sync Travis CI Build Status

Synchronously check if a URL exists.

NPM Badge

Use asynchronously

If you are able to run this in an asynchronous context, I highly recommended that you do so with url-exist since synchronous web requests can hang/freeze clients.

Install

npm install url-exist-sync

Usage

import urlExistSync from "url-exist-sync"

urlExistSync("https://google.com")
//=> true

urlExistSync("https://google.com/404ingURL")
//=> false

urlExistSync("notaurl")
//=> false

API

urlExistSync(url)

url

Type: string

The URL to check.

Related

url-exist-sync's People

Contributors

richienb avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

peassuncao

url-exist-sync's Issues

Doesnt work in ejs file

Describe the bug
Get ERROR in Template execution failed: ReferenceError: FormData is not defined

To Reproduce
Make a new webpack server with an entrypoint as an index.ejs file
Try to compile ejs file

Expected behavior
no error

Screenshots

    if (urlExistsSync(`https://raw.githubusercontent.com/${repositories[i].owner.login}/${repositories[i].name}/master/.github/preview.jpeg`)){
ERROR in Template execution failed: ReferenceError: FormData is not defined

ERROR in   ReferenceError: FormData is not defined
  
  - index.ejs:18874 Object../node_modules/sync-request/lib/browser.js
    /Users/dhaval/git-clones/portfolio/src/templates/default/index.ejs:18874:10
  
  - index.ejs:21 __webpack_require__
    /Users/dhaval/git-clones/portfolio/src/templates/default/index.ejs:21:30
  
  - index.ejs:18503 Object../node_modules/retus/index.js
    /Users/dhaval/git-clones/portfolio/src/templates/default/index.ejs:18503:17
  
  - index.ejs:21 __webpack_require__
    /Users/dhaval/git-clones/portfolio/src/templates/default/index.ejs:21:30
  
  - index.ejs:19163 Object../node_modules/url-exist-sync/index.js
    /Users/dhaval/git-clones/portfolio/src/templates/default/index.ejs:19163:15
  
  - index.ejs:21 __webpack_require__
    /Users/dhaval/git-clones/portfolio/src/templates/default/index.ejs:21:30
  
  - index.ejs:260 
    /Users/dhaval/git-clones/portfolio/src/templates/default/index.ejs:260:22
  
  - index.ejs:411 ./node_modules/html-webpack-plugin/lib/loader.js!./src/templates/default/index.ejs.module.exports
    /Users/dhaval/git-clones/portfolio/src/templates/default/index.ejs:411:3
  
  - index.js:284 
    [portfolio]/[html-webpack-plugin]/index.js:284:18
  
  - task_queues.js:97 processTicksAndRejections
    internal/process/task_queues.js:97:5
  

Child html-webpack-plugin for "index.html":
     2 assets
    Entrypoint undefined = index.html
    [./node_modules/html-webpack-plugin/lib/loader.js!./src/templates/default/index.ejs] 10.2 KiB {0} [built]
        + 45 hidden modules
 「wdm」: Failed to compile.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.