2

I am new in Node.js. I am trying to check whether the given path is file or directory. So i am trying to use fs but when i try to import fs object by require("fs"), application crash and do not load. I have tried some solution to resolve it but all did not work. Here is sample of my code.

define(function (require, exports, module) {
"use strict";

// Brackets modules

var ProjectManager          = require("project/ProjectManager"),
    ExtensionUtils          = require('utils/ExtensionUtils'),
    FileSystem          = brackets.getModule("filesystem/FileSystem"),
    //AppInit           = brackets.getModule("utils/AppInit"),
    shellProvider           = brackets.getModule('shellAPI/shellProvider');
var fs=require("fs");

Where i am doing wrong. Is there any other way to check if it is file or directory

Sumeet Vishwas
  • 585
  • 1
  • 6
  • 18
  • can you provide the error message? – InsOp Sep 01 '16 at 09:22
  • @InsOp when i use require inside define function, it do not return any error instead of that my application fails to load or crash. but i use require on top (out from define function ), it throw error "Module name 'fs' has not been loaded yet for context: _.Use require([]) – Sumeet Vishwas Sep 01 '16 at 10:05

0 Answers0