小编Mel*_*Mel的帖子

运行angularjs karma示例时出错

在introtokarma应用程序中,我更改了karma-e2e-config.js文件,如下所示:

module.exports = function(config) {
  config.set({
    basePath : '../',
      files : ['tests/e2e/**/*.js'],
      frameworks: ['ng-scenario'],
      autoWatch : false,
      browsers : ['Chrome'],
      singleRun : true,
      proxies : {
        '/': 'http://localhost:8000/'
      },
      junitReporter : {
        outputFile: 'test_out/e2e.xml',
        suite: 'e2e'
      }
  });
};
Run Code Online (Sandbox Code Playgroud)

运行代码时,我得到以下输出:

C:\ Project\introtokarma\config> karma start karma-e2e.conf.js
INFO [karma]:Karma v0.10.1服务器在localhost启动:9877/
INFO [launcher]:启动浏览器Chrome
WARN [launcher]:路径应该不被引用.
规范化C:\ Program Files(x86)\ Google\Chrome\Application\chrome.exe
INFO [Chrome 28.0.1500(Windows 7)]的路径:连接套接字ID pfBNNRs-3wAdgT-QsheL
Chrome 28.0.1500(Windows 7 ):执行0 of 0 ERROR(0.207秒/ 0秒)

angularjs karma-runner angularjs-e2e

12
推荐指数
2
解决办法
7428
查看次数

使用gridfs和mongoose在mongodb中存储文件

我有以下代码

gridfs.js具有以下编写文件字节的代码

exports.putFile = function(path, name, options, fn) {
    var db;
    db = mongoose.connection.db;
    options = parse(options);
    options.metadata.filename = name;
    return new GridStore(db, name, "w", options).open(function(err, file) {
        if (err) {
            return fn(err);
        }
        return file.writeFile(path, fn);
    });
};
Run Code Online (Sandbox Code Playgroud)

猫鼬模式定义如下.mongoose模式具有文件名和文件本身.

var fs = require('fs');
var mongoose = require('mongoose');
var db = mongoose.connection;
var gridfs = require('./gridfs');
var Schema = mongoose.Schema;

var trackDocsSchema = mongoose.Schema(
        {
            _id : Schema.Types.ObjectId,
            docName: 'string',
            files: [ mongoose.Schema.Mixed ]
        }
);

trackDocsSchema.methods.addFile = function(file, options, …
Run Code Online (Sandbox Code Playgroud)

javascript mongoose mongodb node.js gridfs

6
推荐指数
1
解决办法
3162
查看次数