# All files / lib/client/files ls.js

96.15% Statements 25/26
75% Branches 3/4
87.5% Functions 7/8
96.15% Lines 25/26

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60

    1x

    1x
    19x

    1x

    19x
    2x

    19x
    2x

    2x
    2x

    2x

    19x

    1x

    1x

    1x

    1x

    1x

    1x

    1x

    1x

    1x

    1x

    1x

    1x

    4x'use strict';

    Object.defineProperty(exports, "__esModule", {
      value: true
    });

    exports.default = function (opts) {
      var api = {
        ls: _callbackify2.default.variadic((0, _prepost.pre)((0, _buffer.preBufferToJson)(0), (0, _cid.preCidToJson)(0), (0, _postmsgRpc.caller)('ipfs.files.ls', opts))),
        lsReadableStream: function lsReadableStream() {
          return _pullStreamToStream2.default.source(api.lsPullStream.apply(api, arguments));
        },

        lsPullStream: function () {
          var lsPullStream = (0, _prepost.pre)((0, _buffer.preBufferToJson)(0), (0, _cid.preCidToJson)(0), (0, _prepost.post)((0, _postmsgRpc.caller)('ipfs.files.lsPullStream', opts), function (res) {
            return _pullPostmsgStream2.default.source(res.name, opts);
          }));

          return function () {
            var deferred = _pullDefer2.default.source();

            lsPullStream.apply(undefined, arguments).then(function (res) {
              return deferred.resolve(res);
            }).catch(function (err) {
              return deferred.abort(err);
            });

            return deferred;
          };
        }()
      };

      return api;
    };

    var _postmsgRpc = require('postmsg-rpc');

    var _callbackify = require('callbackify');

    var _callbackify2 = _interopRequireDefault(_callbackify);

    var _pullDefer = require('pull-defer');

    var _pullDefer2 = _interopRequireDefault(_pullDefer);

    var _pullStreamToStream = require('pull-stream-to-stream');

    var _pullStreamToStream2 = _interopRequireDefault(_pullStreamToStream);

    var _pullPostmsgStream = require('pull-postmsg-stream');

    var _pullPostmsgStream2 = _interopRequireDefault(_pullPostmsgStream);

    var _prepost = require('prepost');

    var _cid = require('../../serialization/cid');

    var _buffer = require('../../serialization/buffer');

    function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }